1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-27 05:35:07 +01:00
ntfy/web/src/app/Prefs.js

34 lines
899 B
JavaScript
Raw Normal View History

2022-03-02 22:16:30 +01:00
import db from "./db";
class Prefs {
2022-03-06 06:02:27 +01:00
async setSound(sound) {
db.prefs.put({key: 'sound', value: sound.toString()});
2022-03-02 22:16:30 +01:00
}
2022-03-06 06:02:27 +01:00
async sound() {
const sound = await db.prefs.get('sound');
2022-03-09 21:58:21 +01:00
return (sound) ? sound.value : "ding";
2022-03-02 22:16:30 +01:00
}
async setMinPriority(minPriority) {
db.prefs.put({key: 'minPriority', value: minPriority.toString()});
}
async minPriority() {
const minPriority = await db.prefs.get('minPriority');
return (minPriority) ? Number(minPriority.value) : 1;
}
async setDeleteAfter(deleteAfter) {
db.prefs.put({key:'deleteAfter', value: deleteAfter.toString()});
}
async deleteAfter() {
const deleteAfter = await db.prefs.get('deleteAfter');
return (deleteAfter) ? Number(deleteAfter.value) : 604800; // Default is one week
}
}
const prefs = new Prefs();
export default prefs;