Add Sandstorm packaging files #26

Merged
prologic merged 7 commits from ocdtrekkie/tube:master into master 20 hours ago

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.

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.
ocdtrekkie added 3 commits 2 days ago
ocdtrekkie added 1 commit 2 days ago
ocdtrekkie added 1 commit 2 days ago
ocdtrekkie added 1 commit 2 days ago
ocdtrekkie changed title from WIP: Add Sandstorm packaging files to Add Sandstorm packaging files 2 days ago
Poster

This is now merge-ready. Here's the experimental listing on the Sandstorm app market: https://apps.sandstorm.io/app/70xjeuj6t85v3s9a3up583q97wu044mnt8aekf3pqs41e3ct2v70?experimental=true

This is now merge-ready. Here's the experimental listing on the Sandstorm app market: https://apps.sandstorm.io/app/70xjeuj6t85v3s9a3up583q97wu044mnt8aekf3pqs41e3ct2v70?experimental=true
Poster

Forgot to submit this note earlier, it was lost in another tab, but it's still worthwhile to note:

Okay, permissions now works, in that if you try to upload, and you don't hold the upload capability, you get a 401. That's great and all, though ideally we should also probably hide the upload button if you don't have permission to use it.

Forgot to submit this note earlier, it was lost in another tab, but it's still worthwhile to note: Okay, permissions now works, in that if you try to upload, and you don't hold the upload capability, you get a 401. That's great and all, though *ideally* we should also probably hide the upload button if you don't have permission to use it.
prologic reviewed 2 days ago
app/app.go Outdated
r := mux.NewRouter().StrictSlash(true)
r.HandleFunc("/", a.indexHandler).Methods("GET", "OPTIONS")
r.HandleFunc("/upload", middleware.OptionallyRequireAdminAuth(a.uploadHandler, authPassword)).Methods("GET", "OPTIONS", "POST")
r.HandleFunc("/upload", middleware.OptionallyRequireAdminAuth(middleware.RequireSandstormUploadPermission(a.uploadHandler, isSandstorm), authPassword)).Methods("GET", "OPTIONS", "POST")
Owner

I would instead probably do something like this:

    if isAdnstrom {
	    r.HandleFunc("/upload", middleware.RequireSandstormUploadPermission(a.uploadHandler), authPassword)).Methods("GET", "OPTIONS", "POST")
    } else {
        	r.HandleFunc("/upload", middleware.OptionallyRequireAdminAuth(middleware(a.uploadHandler), authPassword)).Methods("GET", "OPTIONS", "POST")
    }
I would instead probably do something like this: ```go if isAdnstrom { r.HandleFunc("/upload", middleware.RequireSandstormUploadPermission(a.uploadHandler), authPassword)).Methods("GET", "OPTIONS", "POST") } else { r.HandleFunc("/upload", middleware.OptionallyRequireAdminAuth(middleware(a.uploadHandler), authPassword)).Methods("GET", "OPTIONS", "POST") } ```
Owner

Sorry I didn't write this snippet very well, but hopefully you get the idea?

Sorry I didn't write this snippet very well, but hopefully you get the idea?
prologic approved these changes 2 days ago
Poster

Okay, so I am going to refactor this a little bit more than you describe here as well: I will also replace RequireSandstormUploadPermission(handler, isSandstorm) with RequireSandstormPermission(handler, permission). Instead of passing the environment variable through, I'll pass the permission we are looking for (in this case, "upload") to the func. That way we should be able to reuse this function for #27 in the future, by passing "admin" to the func instead.

Okay, so I am going to refactor this a little bit more than you describe here as well: I will also replace RequireSandstormUploadPermission(handler, isSandstorm) with RequireSandstormPermission(handler, permission). Instead of passing the environment variable through, I'll pass the permission we are looking for (in this case, "upload") to the func. That way we should be able to reuse this function for #27 in the future, by passing "admin" to the func instead.
ocdtrekkie added 1 commit 20 hours ago
prologic approved these changes 20 hours ago
prologic merged commit 70fbc8c7b0 into master 20 hours ago
prologic referenced this issue from a commit 20 hours ago

Reviewers

prologic approved these changes 20 hours ago
The pull request has been merged as 70fbc8c7b0.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: prologic/tube#26
Loading…
There is no content yet.