Explorar el Código

Fixed lefacy path joining problem in agi file library

TC pushbot 5 hace 4 años
padre
commit
52ac658f6b
Se han modificado 4 ficheros con 112 adiciones y 8 borrados
  1. 109 0
      documents/Deploy on Android.md
  2. 2 2
      mod/agi/agi.file.go
  3. 1 6
      web/desktop.system
  4. BIN
      web/img/desktop/system_icon/user.png

+ 109 - 0
documents/Deploy on Android.md

@@ -0,0 +1,109 @@
+# Deploying ArozOS on Android 8.0+
+
+
+
+The following guide show the steps for an experimental deployment of ArozOS on Android Phone without root.
+
+**WARNING! Android as deploy platform is still under development and not officially supported. Please use with your own risk. **
+
+
+
+1. Install Termux. You can get Termux on https://termux.com/ 
+
+2. Go to Application Settings and allow Termix to access Storage. As quote from the original wiki page
+
+   ```
+   'Settings>Apps>Termux>Permissions>Storage' and set to true
+   ```
+
+   See https://wiki.termux.com/wiki/Termux-setup-storage for more information.
+
+3. Launch Termux. 
+
+4. Update apt 
+
+   ```
+   apt update && apt upgrade
+   ```
+
+5. Insert the Micro SD card if you want to use the SD card as main storage. Otherwise, only internal storage of your phone is used
+
+6. Execute ```termux-setup-storage```
+
+7. Execute the following commands to check if storage mounted successfully.
+
+   ```
+   ls ~/storage
+   
+   # You should see the /shared and /external* directories that indicate your internal storage and external storage (SD Card)
+   ```
+
+   The /external* wildcard is different on each machine. On my phone, it is shown as ```external-1```. In the examples below, I will use ```external-1``` instead. 
+
+8. Install git, golang and ffmpeg (for ArozOS)
+
+   ```
+   pkg install git golang ffmpeg -y
+   ```
+
+9. Git clone ArozOS from Github
+
+   ```
+   cd ~/
+   git clone https://github.com/tobychui/arozos
+   ```
+
+10. Build ArozOS from source
+
+    ```
+    cd arozos/src
+    go mod tidy
+    go build
+    ```
+
+11. Check your phone IP address. Write this down for reference later.
+
+    ```
+    ifconfig
+    
+    # You should see something like 
+    # inet 192.168.0.182 netmask 255.255.255.0 broadcast 192.168.0.255
+    ```
+
+    Where in this case, the 192.168.0.182 is my phone IP address. Yours might be different. I will be using  192.168.0.182 in my following examples.
+
+12. Start ArozOS
+
+    ```
+    ./arozos
+    ```
+
+13. Launch ArozOS in your browser: Open http://192.168.0.182:8080 (Replace the IP address with your phone's IP address)
+
+14. Create user account and login just like normal ArozOS initialization process. After you have setup your account and logged into the web desktop interface, visit System Settings > Disk & Storage > Storage Pools
+
+15. Create two new storage pool with the following configs
+
+    ```
+    Name: Internal
+    UUID: mnt
+    Path: ../../storage/shared/
+    Access Permission: READ WRITE
+    Storage Hierarchy: Public Acess Folders
+    (Other leave as default)
+    ```
+
+    **Skip the 2nd File System Handler if you do not have an SD card inserted**
+
+    ```
+    Name: External
+    UUID: sd
+    Path: ../../storage/external-1/
+    Storage Hierarchy: Public Acess Folders
+    (Other leave as default)
+    ```
+
+16. Select "Done" and back to system settings. Select "Reload Selected Pool"
+
+17. Open File Explorer. You should now see two new Vroot created with name "Internal" which is your phone's internal storage and "External" which is your SD card.
+

+ 2 - 2
mod/agi/agi.file.go

@@ -290,7 +290,7 @@ func (g *Gateway) injectFileLibFunctions(vm *otto.Otto, u *user.User) {
 				return reply
 			}
 
-			suitableFiles, err := filepath.Glob(rrootPath + "/" + regexFilename)
+			suitableFiles, err := filepath.Glob(filepath.Join(rrootPath, regexFilename))
 			if err != nil {
 				g.raiseError(err)
 				reply, _ := vm.ToValue(false)
@@ -333,7 +333,7 @@ func (g *Gateway) injectFileLibFunctions(vm *otto.Otto, u *user.User) {
 			return reply
 		}
 
-		suitableFiles, err := specialGlob(rrootPath + "/" + regexFilename)
+		suitableFiles, err := specialGlob(filepath.Join(rrootPath, regexFilename))
 		if err != nil {
 			g.raiseError(err)
 			reply, _ := vm.ToValue(false)

+ 1 - 6
web/desktop.system

@@ -923,7 +923,7 @@
         <div class="ts small single line items">
             <div class="item">
                 <div class="ts mini image">
-                    <img class="usericon" src="img/desktop/system_icon/user.svg">
+                    <img class="usericon" src="img/desktop/system_icon/user.png">
                 </div>
                 <div class="content">
                     <div id="username" class="header">User</div>
@@ -952,11 +952,6 @@
             <i class="maximize icon"></i> Toggle Fullscreen
         </div>
         <div class="ts divider"></div>
-        <!-- 
-            <div class="item" onclick="logout(); hideToolPanel();">
-                <i class="log out icon"></i> Logout
-            </div>
-        -->
         <div class="item hardware" onclick="restart(); hideToolPanel();" ontouchend="restart(); hideToolPanel();">
             <i class="repeat icon"></i> Restart
         </div>

BIN
web/img/desktop/system_icon/user.png