Add readonly mode
parent
b8cbe14ae6
commit
34fd560336
|
@ -603,6 +603,11 @@ class ApiController extends Controller
|
||||||
return new JSONResponse([], Http::STATUS_PRECONDITION_FAILED);
|
return new JSONResponse([], Http::STATUS_PRECONDITION_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure not running in read-only mode
|
||||||
|
if ($this->config->getSystemValue('memories_readonly', false)) {
|
||||||
|
return new JSONResponse(["message" => "Cannot change settings in readonly mode"], Http::STATUS_FORBIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
$userId = $user->getUid();
|
$userId = $user->getUid();
|
||||||
$this->config->setUserValue($userId, Application::APPNAME, $key, $value);
|
$this->config->setUserValue($userId, Application::APPNAME, $key, $value);
|
||||||
|
|
||||||
|
|
|
@ -77,13 +77,16 @@ export default class Settings extends Mixins(UserConfig, GlobalMixin) {
|
||||||
const settings = ['showHidden', 'timelinePath', 'foldersPath'];
|
const settings = ['showHidden', 'timelinePath', 'foldersPath'];
|
||||||
|
|
||||||
// Update all
|
// Update all
|
||||||
|
try {
|
||||||
const p = await Promise.all(settings.map(async (setting) => this.updateSetting(setting)));
|
const p = await Promise.all(settings.map(async (setting) => this.updateSetting(setting)));
|
||||||
|
|
||||||
if (p.some((r) => !r || r.status !== 200)) {
|
if (p.some((r) => !r || r.status !== 200)) {
|
||||||
showError(this.t('memories', 'Error updating settings'));
|
showError(this.t('memories', 'Error updating settings'));
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
showError(e?.response?.data?.message || this.t('memories', 'Error updating settings'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue