mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 15:47:30 +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)) {
|
if (params.has(key)) {
|
||||||
let provided = params.get(key)
|
let provided = params.get(key)
|
||||||
|
|
||||||
|
// Correct common errors in instance URL
|
||||||
if (key === "instance") {
|
if (key === "instance") {
|
||||||
provided = provided.replace(/\/+$/, "")
|
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 (setting.type === "string") {
|
||||||
if (provided) data[key] = provided
|
if (provided) data[key] = provided
|
||||||
else data[key] = null
|
else data[key] = null
|
||||||
|
Loading…
Reference in New Issue
Block a user