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:
@@ -4,27 +4,6 @@ require('../models/db');
|
||||
var config = require('config');
|
||||
const redis = require('../helpers/redis');
|
||||
|
||||
// FIXME TODO object.toJSON()
|
||||
|
||||
var saveAction = (actionKey, object) => {
|
||||
if (object.constructor.modelName == "Space")
|
||||
return;
|
||||
|
||||
let attr = {
|
||||
action: actionKey,
|
||||
space: object.space_id || object.space,
|
||||
user: object.user_id || object.user,
|
||||
editor_name: object.editor_name,
|
||||
object: object
|
||||
};
|
||||
|
||||
/*let action = new Action(attr);
|
||||
action.save(function(err) {
|
||||
if (err)
|
||||
console.error("saved create action err:", err);
|
||||
});*/
|
||||
};
|
||||
|
||||
module.exports = (req, res, next) => {
|
||||
res.header("Cache-Control", "no-cache");
|
||||
|
||||
@@ -36,21 +15,18 @@ module.exports = (req, res, next) => {
|
||||
if (!object) return;
|
||||
redis.sendMessage("create", model, object, req.channelId);
|
||||
this.status(201).json(object);
|
||||
saveAction("create", object);
|
||||
};
|
||||
|
||||
res['distributeUpdate'] = function(model, object) {
|
||||
if (!object) return;
|
||||
redis.sendMessage("update", model, object, req.channelId);
|
||||
this.status(200).json(object);
|
||||
saveAction("update", object);
|
||||
};
|
||||
|
||||
res['distributeDelete'] = function(model, object) {
|
||||
if (!object) return;
|
||||
redis.sendMessage("delete", model, object, req.channelId);
|
||||
this.sendStatus(204);
|
||||
saveAction("delete", object);
|
||||
};
|
||||
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user