1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-22 15:47:30 +00:00

Add /api/settings to get current settings as JSON

This commit is contained in:
Cadence Ember 2022-07-27 18:54:45 +12:00
parent f04be0d3f9
commit 5e6b2bf31c
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -7,6 +7,17 @@ const validate = require("../utils/validate")
const V = validate.V const V = validate.V
module.exports = [ module.exports = [
{
route: "/api/settings", methods: ["GET"], code: async ({req}) => {
const user = getUser(req)
const settings = user.getSettingsOrDefaults()
return {
statusCode: 200,
contentType: "application/json",
content: settings
}
}
},
{ {
route: "/settings", methods: ["GET"], code: async ({req}) => { route: "/settings", methods: ["GET"], code: async ({req}) => {
const user = getUser(req) const user = getUser(req)