mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 07:37:29 +00:00
Delete existing watch history when disabled
This commit is contained in:
parent
699af63583
commit
49d32cfee2
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user