Skip to content

Commit

Permalink
Update v1.109
Browse files Browse the repository at this point in the history
- Added module install tool (Install via git repo and remove)
- Added optional white theme floatWindow option
- Added File Manager search function
- Added new Desktop background pack "city"
- Enhanced thumbnail loading algorithm
- Cluster neighborhood functionality (aka find nearby ArozOS hosts)
- Added support for folder drag drop to folder upload in File Manager
- Fixed Aroz Online Beta filename compatibility mode fail to render bug
- Fixed permission group storage pool synchronization bug
- Fixed port bug in FTP Setting page
- Fixed edit user not exists bug
- Added low memory upload mode (for SBC < 512MB)
- Added http GET, POST and HEAD for agi programming interface
- Added WebDAV support on other Virtual Roots
- Added dynamic generating session key
- Added performance viewer (CPU and RAM usage)

By Alanyeung:

- Updated Photo WebApp

To deploy, copy ./web and ./system from the main source code and place it in the same directory as the binary you choose.

@yeungalan
  • Loading branch information
TC pushbot 5 authored and TC pushbot 5 committed Jan 31, 2021
1 parent fb96e11 commit 338b2bf
Show file tree
Hide file tree
Showing 119 changed files with 41,259 additions and 701 deletions.
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ subservice/backup/.suspended
subservice/backup/backup/.suspended
subservice/aprint
subservice/aprint/*
subservice/minecraft/*
subservice/octave/*

#Binary related
build/*
Expand Down
30 changes: 30 additions & 0 deletions src/AGI Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ USERNAME
USERICON
USERQUOTA_TOTAL
USERQUOTA_USED
//Since AGI 1.3
USER_VROOTS
USER_MODULES //Might return ["*"] for admin permission
```

#### Filepath Virutalization
Expand Down Expand Up @@ -394,6 +398,12 @@ if (!requirelib("filelib")){
A basic image handling library to process images. Allowing basic image resize,
get image dimension and others (to be expanded)


```
//Include the library
requirelib("imagelib");
```

#### ImageLib functions
```
imagelib.getImageDimension("user:/Desktop/test.jpg"); //return {width, height}
Expand All @@ -416,3 +426,23 @@ return true if success, false if failed
```

### http
A basic http function group that allow GET / POST / HEAD / Download request to other web resources

```
//Include the library
requirelib("http");
```

#### http functions
```
http.get("http://example.com/api/"); //Create a get request, return the respond body
http.post("http://localhost:8080/system/file_system/listDir", JSON.stringify({
dir: "user:/Desktop",
sort: "default"
})); //Create a POST request with JSON payload
http.head("http://localhost:8080/", "Content-Type"); //Get the header field "Content-Type" from the requested url, leave 2nd paramter empty to return the whole header in JSON string
http.download("http://example.com/music.mp3", "user:/Desktop", "(Optional) My Music.mp3")
```

117 changes: 117 additions & 0 deletions src/Quick Notes for Setting Up Raspberry Pi 4 as WiFi Router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Quick Notes for Setting Up Raspberry Pi 4 as WiFi Router

This is just a quick notes for myself on how to setup a Raspberry Pi 4 with Mercury AC650M USB WiFi Adapter

### Problem

The current setup of the system make use of a ARGON ONE metal case which, will make the build in WiFi adapter really hard to use as an AP. Hence, we need to setup an external WiFi adapter for this purpose.

### Required Parts

- Mercury USB WiFi Adapter AC650M (Dual baud 5G no driver version)
- ARGON ONE metal case
- Raspberry Pi 4B
- 64GB Micro SD card



### Installation

1. Install Raspberry Pi OS and run apt-updates

2. Download the driver for RTL8821CU

```
mkdir -p ~/build
cd ~/build
git clone https://github.com/brektrou/rtl8821CU.git
```



3. Install DKMS

```
sudo apt-get install dkms
```



4. Upgrade apt

```
sudo apt update -y
sudo apt upgrade -y
```

5. Install bc and reboot

```
sudo apt-get install bc
sudo reboot
```

6. Edit the Make file of the downloaded repo and change these two lines as follows

```
CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_ARM_RPI = n
```

to

```
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y
```

7. Fix the compile flag on ARM processor

```
sudo cp /lib/modules/$(uname -r)/build/arch/arm/Makefile /lib/modules/$(uname -r)/build/arch/arm/Makefile.$(date +%Y%m%d%H%M)
sudo sed -i 's/-msoft-float//' /lib/modules/$(uname -r)/build/arch/arm/Makefile
sudo ln -s /lib/modules/$(uname -r)/build/arch/arm /lib/modules/$(uname -r)/build/arch/armv7l
```

8. Build via DKMS

```
sudo ./dkms-install.sh
```



9. Plug your USB-wifi-adapter into your PC

10. If wifi can be detected, congratulations. If not, maybe you need to switch your device usb mode by the following steps in terminal:

1. Find your usb-wifi-adapter device ID, like "0bda:1a2b", by type: ```lsusb```

2. Need install `usb_modeswitch`

```
sudo usb_modeswitch -KW -v 0bda -p 1a2b
systemctl start bluetooth.service
```
11. Edit `usb_modeswitch` rules:
```
udo nano /lib/udev/rules.d/40-usb_modeswitch.rules
```
12. Append before the end line `LABEL="modeswitch_rules_end"` the following:
```
# Realtek 8211CU Wifi AC USB
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b"
```
22 changes: 22 additions & 0 deletions src/auth.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
package main

import (
"crypto/rand"
"log"
"net/http"

auth "imuslab.com/arozos/mod/auth"
prout "imuslab.com/arozos/mod/prouter"
)

func AuthInit() {
//Generate session key for authentication module if empty
sysdb.NewTable("auth")
if *session_key == "" {
//Check if the key was generated already. If not, generate a new one
if !sysdb.KeyExists("auth", "sessionkey") {
key := make([]byte, 32)
rand.Read(key)
newSessionKey := string(key)
sysdb.Write("auth", "sessionkey", newSessionKey)

log.Println("Authentication session key loaded from database")
} else {
log.Println("New authentication session key generated")
}
skeyString := ""
sysdb.Read("auth", "sessionkey", &skeyString)
session_key = &skeyString
}

//Create an Authentication Agent
authAgent = auth.NewAuthenticationAgent("ao_auth", []byte(*session_key), sysdb, *allow_public_registry, func(w http.ResponseWriter, r *http.Request) {
//Login Redirection Handler, redirect it login.system
w.Header().Set("Cache-Control", "no-cache, no-store, no-transform, must-revalidate, private, max-age=0")
Expand Down
63 changes: 63 additions & 0 deletions src/cluster.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package main

import (
"log"
"net/http"

"imuslab.com/arozos/mod/network/neighbour"
prout "imuslab.com/arozos/mod/prouter"
)

/*
Functions related to ArozOS clusters
Author: tobychui
This is a section of the arozos core that handle cluster
related function endpoints
*/

var (
NeighbourDiscoverer *neighbour.Discoverer
)

func ClusterInit() {
//Only enable cluster scanning on mdns enabled mode
if *allow_mdns && MDNS != nil {
//Start the network discovery
thisDiscoverer := neighbour.NewDiscoverer(MDNS)
//Start a scan immediately (in go routine for non blocking)
go func() {
thisDiscoverer.UpdateScan(3)
}()

//Setup the scanning timer
thisDiscoverer.StartScanning(300, 5)
NeighbourDiscoverer = &thisDiscoverer

//Register the settings
registerSetting(settingModule{
Name: "Neighbourhood",
Desc: "Nearby ArOZ Host for Clustering",
IconPath: "SystemAO/cluster/img/small_icon.png",
Group: "Cluster",
StartDir: "SystemAO/cluster/neighbour.html",
RequireAdmin: false,
})

//Register cluster scanning endpoints
router := prout.NewModuleRouter(prout.RouterOption{
ModuleName: "System Setting",
UserHandler: userHandler,
DeniedHandler: func(w http.ResponseWriter, r *http.Request) {
errorHandlePermissionDenied(w, r)
},
})

router.HandleFunc("/system/cluster/scan", NeighbourDiscoverer.HandleScanningRequest)

} else {
log.Println("MDNS not enabled or startup failed. Skipping Cluster Scanner initiation.")
}

}
Loading

0 comments on commit 338b2bf

Please sign in to comment.