mirror of
https://github.com/spacedeck/spacedeck-open.git
synced 2025-12-16 01:47:30 +01:00
Allow embedding of folders and access to folders to anonymous editors with edit_hash/spaceAuth links (#63)
* add subspaces to be listed with edit_hash/spaceAuth authorization * remove dead code from api_helpers.js * add edit_hash authorization for requested space thumbnails * handle /s/:hash links in frontend router * set space_auth via a function, allow passing it to load_space * rename variable in /s/:hash router in backend * hide search, profile, breadcrumb in folders if not logged in, construct links to subspaces differently for anonymous editors
This commit is contained in:
@@ -115,16 +115,16 @@ router.get('/t/:id', (req, res) => {
|
||||
res.redirect(path);
|
||||
});
|
||||
|
||||
router.get('/s/:token', (req, res) => {
|
||||
var token = req.params.token;
|
||||
if (token.split("-").length > 0) {
|
||||
token = token.split("-")[0];
|
||||
router.get('/s/:hash', (req, res) => {
|
||||
var hash = req.params.hash;
|
||||
if (hash.split("-").length > 0) {
|
||||
hash = hash.split("-")[0];
|
||||
}
|
||||
|
||||
db.Space.findOne({where: {"edit_hash": token}}).then(function (space) {
|
||||
db.Space.findOne({where: {"edit_hash": hash}}).then(function (space) {
|
||||
if (space) {
|
||||
if (req.accepts('text/html')){
|
||||
res.redirect("/spaces/"+space._id + "?spaceAuth=" + token);
|
||||
res.redirect("/spaces/"+space._id + "?spaceAuth=" + hash);
|
||||
} else {
|
||||
res.status(200).json(space);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user