Make Terms of Service editable at runtime by admins (closes #39)

tos.md was baked into the repo and read once at startup, so changing
the terms required a code change and deploy. It's now a Redis-backed
singleton (models/tos.js), editable from a new "Terms of Service" card
on the admin Dashboard, with the bundled tos.md used only as a
one-time seed for new deployments.

- routes/tos.js: GET (any authenticated user) / PUT (app_sso_admin
  only) via /api/tos. Saving can optionally reset every user's
  tos_accepted flag so they're asked to re-accept -- off by default,
  since a wording fix shouldn't re-prompt everyone.
- routes/index.js: /tos and /onboarding now render the live content
  instead of a module-level constant computed once at process start.
This commit is contained in:
2026-07-16 13:44:46 -04:00
parent 8a13dee8ae
commit aaa538c7f9
8 changed files with 195 additions and 16 deletions
+16
View File
@@ -287,6 +287,22 @@ app.oauthClient = (function(app){
return { list, add, remove, update, rotateSecret };
})(app);
app.tos = (function(app){
function get(callback){
return app.api.get('tos/', function(error, data){
if(callback) callback(error, data);
});
}
function update(args, callback){
app.api.put('tos/', args, function(error, data){
callback(error, data);
});
}
return { get, update };
})(app);
app.apiToken = (function(app){
function list(callback){
return app.api.get('api-token/', function(error, data){