1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-09-19 18:57:30 +00:00

Delete existing watch history when disabled

This commit is contained in:
Cadence Ember 2021-04-26 00:00:56 +12:00
parent 699af63583
commit 49d32cfee2
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -33,10 +33,18 @@ module.exports = [
if (params.has(key)) {
let provided = params.get(key)
// Correct common errors in instance URL
if (key === "instance") {
provided = provided.replace(/\/+$/, "")
}
// Delete existing watch history when it's disabled
if (key === "save_history") {
if (provided !== "1") {
db.prepare("DELETE FROM WatchedVideos WHERE token = ?").run(token)
}
}
if (setting.type === "string") {
if (provided) data[key] = provided
else data[key] = null