Skip to content

Commit 79e582d

Browse files
committed
Update v1.124
- Fixed File Selector transition animation bug - Fixed Music module search function - Fixed Music player highlight issue - Fixed touch floatWindow interaction bug - Fixed css bug for Music Embedded player - Fixed share interface not found bug - Fixed critical security bug in diskmg - Fixed ContentLength not serving when gzip enabled bug - Fixed CopyRight year info on some pages - Added Share interface OG preview - Added experimental RISCV64 support - Added floatWindow resize from top edge - Added Music module playlist paging function - Added Memo Deadline highlight function - Added automatic upload mode optimizer logic - Added experimental UPnP auto renew function - Updated MakeFile - Updated Video playlist structure - Optimized Video module UI - Migrated Music module away from Tocas UI and interface update - Migrated File Selector, diskmg, Desktop module away from Tocas UI
1 parent 4cfba4b commit 79e582d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+6749
-760
lines changed

src/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PLATFORMS := darwin/amd64 darwin/arm64 freebsd/amd64 linux/386 linux/amd64 linux/arm linux/arm64 linux/mipsle windows/386 windows/amd64 windows/arm windows/arm64
2-
PLATFORMS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm linux/arm64 linux/mipsle windows/amd64 windows/arm64
2+
PLATFORMS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm linux/arm64 linux/mipsle linux/riscv64 windows/amd64 windows/arm64
33
temp = $(subst /, ,$@)
44
os = $(word 1, $(temp))
55
arch = $(word 2, $(temp))
@@ -65,4 +65,4 @@ web.tar.gz:
6565

6666
arozos_file_checksum.sha1:
6767
@echo "Generating the checksum, if sha1sum installed"
68-
-sha1sum ./dist/arozos_*_* web.tar.gz > ./dist/arozos_file_checksum.sha1
68+
-sha1sum ./dist/web.tar.gz > ./dist/arozos_file_checksum.sha1

src/disk.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ func DiskServiceInit() {
130130
diskmg.HandleMount(w, r, fsHandlers)
131131
})
132132
adminRouter.HandleFunc("/system/disk/diskmg/format", func(w http.ResponseWriter, r *http.Request) {
133+
//Check if request are made in POST mode
134+
if r.Method != http.MethodPost {
135+
w.WriteHeader(http.StatusMethodNotAllowed)
136+
w.Write([]byte("405 - Method Not Allowed"))
137+
return
138+
}
139+
140+
//Check if ArozOS is running in sudo mode
141+
if !sudo_mode {
142+
w.WriteHeader(http.StatusUnauthorized)
143+
w.Write([]byte("401 - Unauthorized (Is ArozOS running in sudo mode?)"))
144+
return
145+
}
146+
133147
//Format option require passing in all filesystem handlers
134148
diskmg.HandleFormat(w, r, fsHandlers)
135149
})

src/file_system.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,22 @@ func system_fs_handleLowMemoryUpload(w http.ResponseWriter, r *http.Request) {
413413
return
414414
}
415415

416+
//Unescape the upload target path
417+
unescapedPath, err := url.PathUnescape(uploadTarget)
418+
if err != nil {
419+
unescapedPath = uploadTarget
420+
}
421+
416422
//Check if the user can write to this folder
417-
if !userinfo.CanWrite(uploadTarget) {
423+
if !userinfo.CanWrite(unescapedPath) {
418424
//No permission
419425
w.WriteHeader(http.StatusForbidden)
420426
w.Write([]byte("403 - Access Denied"))
421427
return
422428
}
423429

424430
//Translate the upload target directory
425-
realUploadPath, err := userinfo.VirtualPathToRealPath(uploadTarget)
431+
realUploadPath, err := userinfo.VirtualPathToRealPath(unescapedPath)
426432
if err != nil {
427433
w.WriteHeader(http.StatusInternalServerError)
428434
w.Write([]byte("500 - Path translation failed"))
@@ -570,7 +576,7 @@ func system_fs_handleLowMemoryUpload(w http.ResponseWriter, r *http.Request) {
570576
}
571577

572578
//Try to decode the location if possible
573-
decodedUploadLocation, err := url.QueryUnescape(targetUploadLocation)
579+
decodedUploadLocation, err := url.PathUnescape(targetUploadLocation)
574580
if err != nil {
575581
decodedUploadLocation = targetUploadLocation
576582
}

src/go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require (
1717
github.com/gabriel-vasile/mimetype v1.4.0
1818
github.com/go-git/go-git/v5 v5.4.2
1919
github.com/go-ldap/ldap v3.0.3+incompatible
20+
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
2021
github.com/golang/snappy v0.0.4 // indirect
2122
github.com/gopherjs/gopherjs v1.17.2 // indirect
2223
github.com/gorilla/sessions v1.2.1
@@ -42,7 +43,7 @@ require (
4243
github.com/xanzy/ssh-agent v0.3.1 // indirect
4344
gitlab.com/NebulousLabs/go-upnp v0.0.0-20211002182029-11da932010b6
4445
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 // indirect
45-
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect
46+
golang.org/x/image v0.0.0-20220617043117-41969df76e82 // indirect
4647
golang.org/x/net v0.0.0-20220513224357-95641704303c // indirect
4748
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
4849
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29

src/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE
166166
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
167167
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
168168
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
169+
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
170+
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
169171
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
170172
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
171173
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -484,6 +486,8 @@ golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+o
484486
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
485487
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 h1:LRtI4W37N+KFebI/qV0OFiLUv4GLOWeEW5hn/KEJvxE=
486488
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
489+
golang.org/x/image v0.0.0-20220617043117-41969df76e82 h1:KpZB5pUSBvrHltNEdK/tw0xlPeD13M6M6aGP32gKqiw=
490+
golang.org/x/image v0.0.0-20220617043117-41969df76e82/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
487491
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
488492
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
489493
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=

src/main.flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var subserviceBasePort = 12810 //Next subservice port
2828

2929
// =========== SYSTEM BUILD INFORMATION ==============
3030
var build_version = "development" //System build flag, this can be either {development / production / stable}
31-
var internal_version = "0.1.123" //Internal build version, [fork_id].[major_release_no].[minor_release_no]
31+
var internal_version = "0.1.124" //Internal build version, [fork_id].[major_release_no].[minor_release_no]
3232
var deviceUUID string //The device uuid of this host
3333
var deviceVendor = "IMUSLAB.INC" //Vendor of the system
3434
var deviceVendorURL = "http://imuslab.com" //Vendor contact information
@@ -37,7 +37,7 @@ var deviceModelDesc = "General Purpose Cloud Platform" //Device Model Descriptio
3737
var iconVendor = "img/vendor/vendor_icon.png" //Vendor icon location
3838
var iconSystem = "img/vendor/system_icon.png" //System icon location
3939

40-
// =========== RUNTTIME RELATED ================S
40+
// =========== RUNTTIME RELATED ================
4141
var max_upload_size int64 = 8192 << 20 //Maxmium upload size, default 8GB
4242
var sudo_mode bool = (os.Geteuid() == 0 || os.Geteuid() == -1) //Check if the program is launched as sudo mode or -1 on windows
4343
var startupTime int64 = time.Now().Unix() //The startup time of the ArozOS Core

src/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"path/filepath"
1111
"strconv"
1212
"syscall"
13+
"time"
1314

1415
console "imuslab.com/arozos/mod/console"
1516
"imuslab.com/arozos/mod/network/gzipmiddleware"
@@ -98,7 +99,7 @@ func main() {
9899
os.Mkdir(*tmp_directory, 0777)
99100

100101
//Print copyRight information
101-
log.Println("ArozOS(C) 2021 " + deviceVendor + ".")
102+
log.Println("ArozOS(C) " + strconv.Itoa(time.Now().Year()) + " " + deviceVendor + ".")
102103
log.Println("ArozOS " + build_version + " Revision " + internal_version)
103104

104105
/*

src/mediaServer.go

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ Example usage:
2424
This will serve / download the file located at files/users/{username}/Desktop/test/02.Orchestra- エミール (Addendum version).mp3
2525
2626
PLEASE ALWAYS USE URLENCODE IN THE LINK PASSED INTO THE /media ENDPOINT
27-
28-
2927
*/
3028

31-
//
32-
3329
func mediaServer_init() {
3430
if *enable_gzip {
3531
http.HandleFunc("/media/", gzipmiddleware.CompressFunc(serverMedia))
@@ -39,6 +35,8 @@ func mediaServer_init() {
3935
http.HandleFunc("/media/getMime/", serveMediaMime)
4036
}
4137

38+
//Download API always bypass gzip no matter if gzip mode is enabled
39+
http.HandleFunc("/media/download/", serverMedia)
4240
}
4341

4442
//This function validate the incoming media request and return the real path for the targed file
@@ -57,6 +55,9 @@ func media_server_validateSourceFile(w http.ResponseWriter, r *http.Request) (st
5755

5856
targetfile, _ := common.Mv(r, "file", false)
5957
targetfile, err = url.QueryUnescape(targetfile)
58+
if err != nil {
59+
return "", err
60+
}
6061
if targetfile == "" {
6162
return "", errors.New("Missing paramter 'file'")
6263
}
@@ -138,22 +139,38 @@ func serverMedia(w http.ResponseWriter, r *http.Request) {
138139
downloadMode = true
139140
}
140141

142+
//New download implementations, allow /download to be used instead of &download=true
143+
if strings.Contains(r.RequestURI, "media/download/?file=") {
144+
downloadMode = true
145+
}
146+
141147
//Serve the file
142148
if downloadMode {
143-
userAgent := r.Header.Get("User-Agent")
144-
filename := strings.ReplaceAll(url.QueryEscape(filepath.Base(realFilepath)), "+", "%20")
145-
log.Println(r.Header.Get("User-Agent"))
146-
147-
if strings.Contains(userAgent, "Safari/") {
148-
//This is Safari. Use speial header
149-
w.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(realFilepath))
150-
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
151-
} else {
152-
//Fixing the header issue on Golang url encode lib problems
153-
w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+filename)
154-
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
149+
escapedRealFilepath, err := url.PathUnescape(realFilepath)
150+
if err != nil {
151+
common.SendErrorResponse(w, err.Error())
152+
return
155153
}
154+
filename := filepath.Base(escapedRealFilepath)
155+
156+
/*
157+
//12 Jul 2022 Update: Deprecated the browser detection logic
158+
userAgent := r.Header.Get("User-Agent")
159+
if strings.Contains(userAgent, "Safari/")) {
160+
//This is Safari. Use speial header
161+
w.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(realFilepath))
162+
} else {
163+
//Fixing the header issue on Golang url encode lib problems
164+
w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+filename)
165+
}
166+
*/
167+
168+
w.Header().Set("Content-Disposition", "attachment; filename=\""+filename+"\"")
169+
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
170+
171+
http.ServeFile(w, r, escapedRealFilepath)
172+
} else {
173+
http.ServeFile(w, r, realFilepath)
156174
}
157175

158-
http.ServeFile(w, r, realFilepath)
159176
}

src/mod/database/database_core.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !mipsle
2-
// +build !mipsle
1+
//go:build !mipsle && !riscv64
2+
// +build !mipsle,!riscv64
33

44
package database
55

src/mod/database/database_openwrt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build mipsle
2-
// +build mipsle
1+
//go:build mipsle || riscv64
2+
// +build mipsle riscv64
33

44
package database
55

0 commit comments

Comments
 (0)