Skip to content

Commit

Permalink
Updates v1.111
Browse files Browse the repository at this point in the history
+ Added Custom wallpaper option
+ Added Personalization util for desktop
+ IoT Hub with support for HDSv1, HDSv2 and Tasmota with Sonoff S2X sockets
+ Added robot.txt and human.txt
+ Moved WsTTY out of ArozOS Core
+ Added gzip handler in mrouter

- Fixed bugs on storage pool folder creation
- Fixed File Manager one folder download bug
- Fixed File Manager open bug on Windows host
- Fixed typo in mrouter
- Fixed 404 bugs on redirection portal
- Fixed WsTTY interface in NotepadA
- Fixed embedded Audio player bug
- Fixed listdir unable to list folder name with + sign issue
- Added test scan interface and command line
- Removed dependency on pretty

+ Added 1.110 first stable release celebration painting

By @yeungalan
+ Updates SMART implementation
+ Updated SMART UI

By @Colton-Ko
+ Added FreeBSD support for hardware info page
  • Loading branch information
TC pushbot 5 authored and TC pushbot 5 committed Apr 1, 2021
1 parent 974ae3a commit 60b9321
Show file tree
Hide file tree
Showing 207 changed files with 4,815 additions and 2,076 deletions.
17 changes: 11 additions & 6 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ system/aecron/*.log
web/teleprompter/*

#Subservice related
subservice/backup/.suspended
subservice/backup/backup/.suspended
subservice/aprint
subservice/aprint/*
subservice/minecraft/*
subservice/octave/*
subservice/*

!subservice/ArSamba
!subservice/ArSamba/*

!subservice/demo
!subservice/demo/*

!subservice/WsTTY/
!subservice/WsTTY/*

#Binary related
build/*
Expand All @@ -46,3 +50,4 @@ aroz_online
arozos.exe
*/arozos.exe
arozos
upx.exe
103 changes: 103 additions & 0 deletions src/AGI Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,106 @@ http.download("http://example.com/music.mp3", "user:/Desktop", "(Optional) My Mu
```

### websocket

websocket library provide request upgrade from normal HTTP request to WebSocket connections.

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

#### websocket functions

```
websocket.upgrade(10); //Timeout value in integer, return false if failed
var recv = websocket.read(); //Blocking websocket listen
websocket.send("Hello World"); //Send websocket to client (web UI)
websocket.close(); //Close websocket connection
```



#### Usage Example

Font-end

```
function getWSEndpoint(){
//Open opeartion in websocket
let protocol = "wss://";
if (location.protocol !== 'https:') {
protocol = "ws://";
}
wsControlEndpoint = (protocol + window.location.hostname + ":" + window.location.port);
return wsControlEndpoint;
}
let socket = new WebSocket(getWSEndpoint() + "/system/ajgi/interface?script=UnitTest/special/websocket.js");
socket.onopen = function(e) {
log("✔️ Socket Opened");
};
socket.onmessage = function(event) {
log(`✔️ Received: ${event.data}`);
};
socket.onclose = function(event) {
if (event.wasClean) {
log(`📪 Connection Closed Cleanly code=${event.code} reason=${event.reason}`);
} else {
// e.g. server process killed or network down
// event.code is usually 1006 in this case
log(`❌ Connection Closed Unexpectedly`);
}
};
socket.onerror = function(error) {
log(`❌ ERROR! ${error.message}`);
};
```

Backend example (without error handling). See the UnitTest/special/websocket.js for example with error handling.

```
function setup(){
//Require the WebSocket Library
requirelib("websocket");
websocket.upgrade(10);
console.log("WebSocket Opened!")
return true;
}
function waitForStart(){
websocket.send("Type something to start test");
var recv = websocket.read();
console.log(recv);
}
function loop(i){
websocket.send("Hello World: " + i);
//Wait for 1 second before next send
delay(1000);
}
function closing(){
//Try to close the WebSocket connection
websocket.close();
}
//Start executing the script
if (setup()){
waitForStart();
for (var i = 0; i < 10; i++){
loop(i);
}
closing();
}else{
console.log("WebSocket Setup Failed.")
}
```

102 changes: 0 additions & 102 deletions src/FUNCLIST.md

This file was deleted.

45 changes: 24 additions & 21 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# ArOZ Online
# ArozOS

This is the go implementation of ArOZ Online Web Desktop environment, perfect for Linux server usage.
This is the go implementation of ArozOS (aka ArOZ Online) Web Desktop environment,designed to run on linux, but somehow still works on Windows and Mac OS

## Development Notes

WIP
- Start each module with {ModuleName}Init() function, e.g. ```WiFiInit()```
- Put your function in module (if possible) and call it in the main program
- Do not change the sequence in the startup() function unless necessary
- When in doubt, add startup flags (and use startup flag to disable experimental functions on startup)

## ArOZ JavaScript Gateway Interface / Plugin Loader
The ArOZ AJGI / AGI interface provide a javascript programmable interface for ArOZ Online users to create
The ArOZ AJGI / AGI interface provide a JavaScript programmable interface for ArozOS users to create
plugin for the system. To initiate the module, you can place a "init.agi" file in the web directory of the module
(also named the module root). See more details in the [AJGI Documentation](AJGI Documentation.md).

Expand All @@ -19,12 +22,13 @@ For example, you have a module that provides web ui named "demo.exe",
then your should put the demo.exe into "./subservice/demo/demo.exe".

In the case of Linux environment, the subservice routine will first if the
module is installed via apt-get by checking with the "whereis" program.
module is installed via apt-get by checking with the "which" program. (If you got busybox, it should be built in)
If the package is not found in the apt list, the binary of the program will be searched
under the subservice directory.

Please follow the naming convention given in the build.sh template.
For example, the corrisponding platform will search for the corrisponding binary excutable filename:
For example, the corresponding platform will search for the corresponding binary excitable filename:

```
demo_linux_amd64 => Linux AMD64
demo_linux_arm => Linux ARMv6l / v7l
Expand All @@ -33,14 +37,15 @@ demo_macOS_amd64 => MacOS AMD64 (Not tested)
```

### Startup Flags
During the tartup of the subservice, two paramters will be passed in. Here are the examples
During the startup of the subservice, two types of parameter will be passed in. Here are the examples
```
demo.exe -info
demo.exe -port 12810
demo.exe -port 12810 -rpt "http://localhost:8080/api/ajgi/interface"
```

In the case of reciving the "info" flag, the program should print the JSON string with correct module information
In the case of receiving the "info" flag, the program should print the JSON string with correct module information
as stated in the struct below.

```
//Struct for storing module information
type serviecInfo struct{
Expand Down Expand Up @@ -82,7 +87,7 @@ fmt.Println(string(infoObject))
os.Exit(0);
```

When reciving the port flag, the program should start the web ui at the given port. The following is an example for
When receiving the port flag, the program should start the web ui at the given port. The following is an example for
the implementation of such functionality.

```
Expand All @@ -103,7 +108,7 @@ use the following setting files.
```
.noproxy => Do not start a proxy to the given port
.startscript => Send the launch parameter to the "start.bat" or "start.sh" file instead of the binary executable
.suspended => Do not load this subservice during startup. But the user can enable it via the setting interface
.disabled => Do not load this subservice during startup. But the user can enable it via the setting interface
```

Here is an example "start.bat" used in integrating Syncthing into ArOZ Online System with ".startscript" file placed next
Expand All @@ -123,16 +128,16 @@ sudo ./aroz_online_linux_amd64
```

And then you can create a new file called "aroz-online.service" in /etc/systemd/system with the following contents (Assume your aroz online root is at /home/pi/aroz_online)
And then you can create a new file called "arozos.service" in /etc/systemd/system with the following contents (Assume your aroz online root is at /home/pi/arozos)

```
[Unit]
Description=ArOZ Online Cloud Desktop Service.
Description=ArozOS Cloud Desktop Service.
[Service]
Type=simple
WorkingDirectory=/home/pi/aroz_online/
ExecStart=/bin/bash /home/pi/aroz_online/start.sh
WorkingDirectory=/home/pi/arozos/
ExecStart=/bin/bash /home/pi/arozos/start.sh
Restart=always
RestartSec=10
Expand All @@ -141,21 +146,19 @@ RestartSec=10
WantedBy=multi-user.target
```

Finally to enable the service, use the following systemd commnads
Finally to enable the service, use the following systemd commands

```
#Enable the script during the startup process
sudo systemctl enable aroz-online.service
sudo systemctl enable arozos.service
#Start the service now
sudo systemctl start aroz-online.service
sudo systemctl start arozos.service
#Show the status of the service
systemctl status aroz-online.service
systemctl status arozos.service
#Disable the service if you no longer want it to start during boot
sudo systemctl disable aroz-online.service
```

See more on how to use systemd over here: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
27 changes: 0 additions & 27 deletions src/arsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,4 @@ func ArsmInit() {
RequireAdmin: false,
})

/*
WsTerminal
The terminal that perform remote WebSocket based reverse ssh
*/
/*
wstRouter := prout.NewModuleRouter(prout.RouterOption{
ModuleName: "System Setting",
AdminOnly: true,
UserHandler: userHandler,
DeniedHandler: func(w http.ResponseWriter, r *http.Request) {
sendErrorResponse(w, "Permission Denied")
},
})
//Register settings
registerSetting(settingModule{
Name: "WsTerminal",
Desc: "Remote WebSocket Shell Terminal",
IconPath: "SystemAO/arsm/img/wst.png",
Group: "Cluster",
StartDir: "SystemAO/arsm/wsterminal.html",
RequireAdmin: true,
})
log.Println("WebSocket Terminal, WIP: ", wstRouter)
*/
}
Loading

0 comments on commit 60b9321

Please sign in to comment.