disable comment cache and pressure for default
This commit is contained in:
@@ -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="在某些情况下显示彩蛋"
|
||||||
/>
|
/>
|
||||||
|
|||||||
32
src/cache.js
32
src/cache.js
@@ -6,21 +6,23 @@ class Cache {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.db=null;
|
this.db=null;
|
||||||
this.added_items_since_maintenance=0;
|
this.added_items_since_maintenance=0;
|
||||||
const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER);
|
if(window.config.comment_cache) {
|
||||||
open_req.onerror=console.error.bind(console);
|
const open_req=indexedDB.open('hole_cache_db',CACHE_DB_VER);
|
||||||
open_req.onupgradeneeded=(event)=>{
|
open_req.onerror=console.error.bind(console);
|
||||||
console.log('comment cache db upgrade');
|
open_req.onupgradeneeded=(event)=>{
|
||||||
const db=event.target.result;
|
console.log('comment cache db upgrade');
|
||||||
const store=db.createObjectStore('comment',{
|
const db=event.target.result;
|
||||||
keyPath: 'pid',
|
const store=db.createObjectStore('comment',{
|
||||||
});
|
keyPath: 'pid',
|
||||||
store.createIndex('last_access','last_access',{unique: false});
|
});
|
||||||
};
|
store.createIndex('last_access','last_access',{unique: false});
|
||||||
open_req.onsuccess=(event)=>{
|
};
|
||||||
console.log('comment cache db loaded');
|
open_req.onsuccess=(event)=>{
|
||||||
this.db=event.target.result;
|
console.log('comment cache db loaded');
|
||||||
setTimeout(this.maintenance.bind(this),1);
|
this.db=event.target.result;
|
||||||
};
|
setTimeout(this.maintenance.bind(this),1);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get(pid,target_version) {
|
get(pid,target_version) {
|
||||||
|
|||||||
Reference in New Issue
Block a user