summaryrefslogtreecommitdiff
path: root/app/app.go
diff options
context:
space:
mode:
authorJacob Weisz <ocdtrekkie@noreply@mills.io>2022-09-24 05:29:27 +0000
committerJames Mills <james@mills.io>2022-09-24 05:29:27 +0000
commit70fbc8c7b0d65fd71878520e5cb14e4a494137fa (patch)
tree33ee4a923fd9647e056304a755d775517fd34592 /app/app.go
parent29f278459156f7bd9aec225ed78706d18e001c56 (diff)
Add Sandstorm packaging files (#26)
I am not quite done here, I need to finish some of the packaging metadata, and I am going to maybe take a pass at permissions prior to release. Opening the pull request so you can easily track the progress. Note that Sandstorm app metadata is supposed to be less than 1 MB total, so I optimized your screenshots. I dare you to tell the difference with the naked eye. Co-authored-by: Jacob Weisz <inbox@jacobweisz.com> Reviewed-on: https://git.mills.io/prologic/tube/pulls/26 Co-authored-by: Jacob Weisz <ocdtrekkie@noreply@mills.io> Co-committed-by: Jacob Weisz <ocdtrekkie@noreply@mills.io>
Diffstat (limited to 'app/app.go')
-rw-r--r--app/app.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/app.go b/app/app.go
index 6b89c5b..11b06f4 100644
--- a/app/app.go
+++ b/app/app.go
@@ -97,10 +97,15 @@ func NewApp(cfg *Config) (*App, error) {
// Setup Router
authPassword := os.Getenv("auth_password")
+ isSandstorm := os.Getenv("SANDSTORM")
r := mux.NewRouter().StrictSlash(true)
r.HandleFunc("/", a.indexHandler).Methods("GET", "OPTIONS")
- r.HandleFunc("/upload", middleware.OptionallyRequireAdminAuth(a.uploadHandler, authPassword)).Methods("GET", "OPTIONS", "POST")
+ if isSandstorm == "1" {
+ r.HandleFunc("/upload", middleware.RequireSandstormPermission(a.uploadHandler, "upload")).Methods("GET", "OPTIONS", "POST")
+ } else {
+ r.HandleFunc("/upload", middleware.OptionallyRequireAdminAuth(a.uploadHandler, authPassword)).Methods("GET", "OPTIONS", "POST")
+ }
r.HandleFunc("/import", a.importHandler).Methods("GET", "OPTIONS", "POST")
r.HandleFunc("/v/{id}.mp4", a.videoHandler).Methods("GET")
r.HandleFunc("/v/{prefix}/{id}.mp4", a.videoHandler).Methods("GET")