Browse Source

disable comment cache and pressure for default

dev
xmcp 6 years ago
parent
commit
b2c7238ab0
  1. 7
      src/Config.js
  2. 2
      src/cache.js

7
src/Config.js

@ -12,11 +12,12 @@ const BUILTIN_IMGS={
const DEFAULT_CONFIG={ const DEFAULT_CONFIG={
background_img: 'static/bg/eriri.jpg', background_img: 'static/bg/eriri.jpg',
background_color: '#112244', background_color: '#112244',
pressure: true, pressure: false,
quote: true, quote: true,
horizontal_scroll: true, horizontal_scroll: true,
color_picker: true, color_picker: true,
easter_egg: true, easter_egg: true,
comment_cache: false,
}; };
export function load_config() { export function load_config() {
@ -203,6 +204,10 @@ export class ConfigUI extends PureComponent {
description="为不同人的回复分配不同颜色" description="为不同人的回复分配不同颜色"
/> />
<hr /> <hr />
<ConfigSwitch callback={this.save_changes_bound} id="comment_cache" name="评论缓存"
description="缓存已读树洞的评论(加载更快,但可能有bug)"
/>
<hr />
<ConfigSwitch callback={this.save_changes_bound} id="easter_egg" name="允许彩蛋" <ConfigSwitch callback={this.save_changes_bound} id="easter_egg" name="允许彩蛋"
description="在某些情况下显示彩蛋" description="在某些情况下显示彩蛋"
/> />

2
src/cache.js

@ -6,6 +6,7 @@ class Cache {
constructor() { constructor() {
this.db=null; this.db=null;
this.added_items_since_maintenance=0; this.added_items_since_maintenance=0;
if(window.config.comment_cache) {
const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER); const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER);
open_req.onerror=console.error.bind(console); open_req.onerror=console.error.bind(console);
open_req.onupgradeneeded=(event)=>{ open_req.onupgradeneeded=(event)=>{
@ -22,6 +23,7 @@ class Cache {
setTimeout(this.maintenance.bind(this),1); setTimeout(this.maintenance.bind(this),1);
}; };
} }
}
get(pid,target_version) { get(pid,target_version) {
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{

Loading…
Cancel
Save