diff --git a/src/Config.js b/src/Config.js index edb7e6f..7280460 100644 --- a/src/Config.js +++ b/src/Config.js @@ -12,11 +12,12 @@ const BUILTIN_IMGS={ const DEFAULT_CONFIG={ background_img: 'static/bg/eriri.jpg', background_color: '#112244', - pressure: true, + pressure: false, quote: true, horizontal_scroll: true, color_picker: true, easter_egg: true, + comment_cache: false, }; export function load_config() { @@ -203,6 +204,10 @@ export class ConfigUI extends PureComponent { description="为不同人的回复分配不同颜色" />
+ +
diff --git a/src/cache.js b/src/cache.js index 99df70f..d470ba8 100644 --- a/src/cache.js +++ b/src/cache.js @@ -6,21 +6,23 @@ class Cache { constructor() { this.db=null; this.added_items_since_maintenance=0; - const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER); - open_req.onerror=console.error.bind(console); - open_req.onupgradeneeded=(event)=>{ - console.log('comment cache db upgrade'); - const db=event.target.result; - const store=db.createObjectStore('comment',{ - keyPath: 'pid', - }); - store.createIndex('last_access','last_access',{unique: false}); - }; - open_req.onsuccess=(event)=>{ - console.log('comment cache db loaded'); - this.db=event.target.result; - setTimeout(this.maintenance.bind(this),1); - }; + if(window.config.comment_cache) { + const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER); + open_req.onerror=console.error.bind(console); + open_req.onupgradeneeded=(event)=>{ + console.log('comment cache db upgrade'); + const db=event.target.result; + const store=db.createObjectStore('comment',{ + keyPath: 'pid', + }); + store.createIndex('last_access','last_access',{unique: false}); + }; + open_req.onsuccess=(event)=>{ + console.log('comment cache db loaded'); + this.db=event.target.result; + setTimeout(this.maintenance.bind(this),1); + }; + } } get(pid,target_version) {