2020-07-17 13:24:20 +03:00
|
|
|
import * as MW from "~/node_common/middleware";
|
|
|
|
|
|
|
|
import DB from "~/node_common/database";
|
2020-07-22 07:11:13 +03:00
|
|
|
import PG from "~/node_common/powergate";
|
2020-07-17 13:24:20 +03:00
|
|
|
|
|
|
|
const initCORS = MW.init(MW.CORS);
|
2020-07-22 07:11:13 +03:00
|
|
|
const initAuth = MW.init(MW.RequireCookieAuthentication);
|
2020-07-17 13:24:20 +03:00
|
|
|
|
|
|
|
export default async (req, res) => {
|
|
|
|
initCORS(req, res);
|
2020-07-22 07:11:13 +03:00
|
|
|
initAuth(req, res);
|
|
|
|
|
|
|
|
// TODO(jim): POWERGATE_ISSUE
|
|
|
|
// Should work when our hosted Powergate works.
|
|
|
|
if (req.body.type === "SET_DEFAULT_STORAGE_CONFIG") {
|
|
|
|
let data;
|
|
|
|
try {
|
|
|
|
data = await PG.ffs.setDefaultStorageConfig(req.body.config);
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
return res
|
|
|
|
.status(500)
|
|
|
|
.send({ decorator: "SERVER_USER_UPDATE_SETTINGS_CONFIG", error: true });
|
|
|
|
}
|
|
|
|
}
|
2020-07-17 13:24:20 +03:00
|
|
|
|
|
|
|
return res.status(200).json({ decorator: "SERVER_USER_UPDATE" });
|
|
|
|
};
|