mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-12-23 04:54:41 +00:00
Compare commits
5 Commits
0.4.5-alph
...
v0.4.4-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cd5c92a4c | ||
|
|
9d6381d7ac | ||
|
|
e5b172627a | ||
|
|
bbbb3b2f29 | ||
|
|
1453eac570 |
6
.github/workflows/push_test_server.yml
vendored
6
.github/workflows/push_test_server.yml
vendored
@@ -2,7 +2,7 @@ name: Auto Publish Website
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- community
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
jobs:
|
jobs:
|
||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
- name: git global
|
- name: git global
|
||||||
run: sudo git config --global --add safe.directory '*'
|
run: sudo git config --global --add safe.directory '*'
|
||||||
- name: set version
|
- name: set version
|
||||||
run: sudo git tag v99.99.99-alpha
|
run: sudo git tag v00.00.00-alpha
|
||||||
|
|
||||||
- name: Fetch all tags
|
- name: Fetch all tags
|
||||||
run: sudo git fetch --force --tags
|
run: sudo git fetch --force --tags
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: 1.14.1
|
||||||
args: release --rm-dist --snapshot
|
args: release --rm-dist --snapshot
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: 1.14.1
|
||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ package common
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
SERVICENAME = "casaos"
|
SERVICENAME = "casaos"
|
||||||
VERSION = "0.4.4"
|
VERSION = "0.4.4.1"
|
||||||
BODY = " "
|
BODY = " "
|
||||||
)
|
)
|
||||||
|
|||||||
31
route/v2.go
31
route/v2.go
@@ -148,15 +148,46 @@ func InitV2DocRouter(docHTML string, docYAML string) http.Handler {
|
|||||||
|
|
||||||
func InitFile() http.Handler {
|
func InitFile() http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
token := r.URL.Query().Get("token")
|
||||||
|
if len(token) == 0 {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
|
w.Write([]byte(`{"message": "token not found"}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
valid, _, errs := jwt.Validate(token, func() (*ecdsa.PublicKey, error) { return external.GetPublicKey(config.CommonInfo.RuntimePath) })
|
||||||
|
if errs != nil || !valid {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
|
w.Write([]byte(`{"message": "validation failure"}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
filePath := r.URL.Query().Get("path")
|
filePath := r.URL.Query().Get("path")
|
||||||
fileName := path.Base(filePath)
|
fileName := path.Base(filePath)
|
||||||
w.Header().Add("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(fileName))
|
w.Header().Add("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(fileName))
|
||||||
http.ServeFile(w, r, filePath)
|
http.ServeFile(w, r, filePath)
|
||||||
|
//http.ServeFile(w, r, filePath)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitDir() http.Handler {
|
func InitDir() http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
token := r.URL.Query().Get("token")
|
||||||
|
if len(token) == 0 {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
|
w.Write([]byte(`{"message": "token not found"}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
valid, _, errs := jwt.Validate(token, func() (*ecdsa.PublicKey, error) { return external.GetPublicKey(config.CommonInfo.RuntimePath) })
|
||||||
|
if errs != nil || !valid {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
|
w.Write([]byte(`{"message": "validation failure"}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
t := r.URL.Query().Get("format")
|
t := r.URL.Query().Get("format")
|
||||||
files := r.URL.Query().Get("files")
|
files := r.URL.Query().Get("files")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user