修改设置(折叠豁免、忽略所有折叠洞)
This commit is contained in:
@@ -3,8 +3,10 @@ import React, { PureComponent } from 'react';
|
|||||||
import './Config.css';
|
import './Config.css';
|
||||||
|
|
||||||
const BUILTIN_IMGS = {
|
const BUILTIN_IMGS = {
|
||||||
|
'https://www.tsinghua.edu.cn/images/footer.jpg':
|
||||||
|
'清华紫(默认)',
|
||||||
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/gbp.jpg':
|
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/gbp.jpg':
|
||||||
'寻觅繁星(默认)',
|
'寻觅繁星',
|
||||||
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/eriri.jpg':
|
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/eriri.jpg':
|
||||||
'平成著名画师',
|
'平成著名画师',
|
||||||
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/yurucamp.jpg':
|
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/yurucamp.jpg':
|
||||||
@@ -21,13 +23,14 @@ const BUILTIN_IMGS = {
|
|||||||
|
|
||||||
const DEFAULT_CONFIG = {
|
const DEFAULT_CONFIG = {
|
||||||
background_img:
|
background_img:
|
||||||
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/gbp.jpg',
|
'https://www.tsinghua.edu.cn/images/footer.jpg',
|
||||||
background_color: '#113366',
|
background_color: '#113366',
|
||||||
pressure: false,
|
pressure: false,
|
||||||
easter_egg: true,
|
easter_egg: true,
|
||||||
color_scheme: 'default',
|
color_scheme: 'default',
|
||||||
fold: true,
|
no_c_post: false,
|
||||||
block_words: [],
|
block_words: [],
|
||||||
|
whitelist_cw: []
|
||||||
};
|
};
|
||||||
|
|
||||||
export function load_config() {
|
export function load_config() {
|
||||||
@@ -370,7 +373,7 @@ export class ConfigUI extends PureComponent {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b>
|
<b>
|
||||||
修改设置后{' '}
|
部分设置修改后需要{' '}
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@@ -407,6 +410,16 @@ export class ConfigUI extends PureComponent {
|
|||||||
parse={(string) => string.split('\n')}
|
parse={(string) => string.split('\n')}
|
||||||
/>
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
|
<ConfigTextArea
|
||||||
|
id="whitelist_cw"
|
||||||
|
callback={this.save_changes_bound}
|
||||||
|
name="展开指定的折叠警告"
|
||||||
|
description={'完全匹配的树洞不会被折叠,每行一个豁免词,也可使用一个星号("*")表示豁免所有'}
|
||||||
|
display={(array) => array.join('\n')}
|
||||||
|
sift={(array) => array.filter((v) => v)}
|
||||||
|
parse={(string) => string.split('\n')}
|
||||||
|
/>
|
||||||
|
<hr />
|
||||||
<ConfigSwitch
|
<ConfigSwitch
|
||||||
callback={this.save_changes_bound}
|
callback={this.save_changes_bound}
|
||||||
id="pressure"
|
id="pressure"
|
||||||
@@ -423,15 +436,15 @@ export class ConfigUI extends PureComponent {
|
|||||||
<hr />
|
<hr />
|
||||||
<ConfigSwitch
|
<ConfigSwitch
|
||||||
callback={this.save_changes_bound}
|
callback={this.save_changes_bound}
|
||||||
id="fold"
|
id="no_c_post"
|
||||||
name="折叠树洞"
|
name="忽略折叠的树洞"
|
||||||
description="在时间线中折叠可能引起不适的树洞"
|
description="不获取所有带折叠警告的树洞,折叠警告豁免将不起作用"
|
||||||
/>
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
<p>
|
<p>
|
||||||
新功能建议或问题反馈请在
|
新功能建议或问题反馈请在
|
||||||
<a
|
<a
|
||||||
href="https://github.com/thuhole/thuhole-go-backend/issues"
|
href="https://github.com/newthuhole/hole-backend/issues"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
GitHub <span className="icon icon-github" />
|
GitHub <span className="icon icon-github" />
|
||||||
|
|||||||
12
src/Flows.js
12
src/Flows.js
@@ -666,7 +666,7 @@ class FlowItemRow extends PureComponent {
|
|||||||
super(props);
|
super(props);
|
||||||
this.needFold = props.info.cw &&
|
this.needFold = props.info.cw &&
|
||||||
(props.search_param === '热榜' || !props.search_param) &&
|
(props.search_param === '热榜' || !props.search_param) &&
|
||||||
window.config.fold &&
|
(window.config.whitelist_cw.indexOf('*')==-1 && window.config.whitelist_cw.indexOf(props.info.cw)==-1) &&
|
||||||
props.mode !== 'attention' && props.mode !== 'attention_finished';
|
props.mode !== 'attention' && props.mode !== 'attention_finished';
|
||||||
this.state = {
|
this.state = {
|
||||||
replies: [],
|
replies: [],
|
||||||
@@ -897,7 +897,7 @@ class FlowItemRow extends PureComponent {
|
|||||||
)}
|
)}
|
||||||
<Time stamp={this.props.info.timestamp} short={true} />
|
<Time stamp={this.props.info.timestamp} short={true} />
|
||||||
<span className="box-header-badge">
|
<span className="box-header-badge">
|
||||||
{this.needFold ? '已隐藏' : '已屏蔽'}
|
{this.needFold ? '已折叠' : '已屏蔽'}
|
||||||
</span>
|
</span>
|
||||||
<div style={{ clear: 'both' }} />
|
<div style={{ clear: 'both' }} />
|
||||||
</div>
|
</div>
|
||||||
@@ -1095,10 +1095,10 @@ export class Flow extends PureComponent {
|
|||||||
json.data.forEach((x) => {
|
json.data.forEach((x) => {
|
||||||
if (x.comments) {
|
if (x.comments) {
|
||||||
let comment_json = {
|
let comment_json = {
|
||||||
'code': 0,
|
code: 0,
|
||||||
'attention': x.attention,
|
attention: x.attention,
|
||||||
'data': x.comments
|
data: x.comments,
|
||||||
}
|
};
|
||||||
//console.log('My cache', comment_json, x.pid, x.reply)
|
//console.log('My cache', comment_json, x.pid, x.reply)
|
||||||
cache().put(x.pid, parseInt(x.reply, 10), comment_json);
|
cache().put(x.pid, parseInt(x.reply, 10), comment_json);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ const MAX_IMG_DIAM = 8000;
|
|||||||
const MAX_IMG_PX = 5000000;
|
const MAX_IMG_PX = 5000000;
|
||||||
const MAX_IMG_FILESIZE = 450000 * BASE64_RATE;
|
const MAX_IMG_FILESIZE = 450000 * BASE64_RATE;
|
||||||
|
|
||||||
const REPOSITORY = 'https://a.com/b';
|
const REPOSITORY = 'https://github.com/newthuhole';
|
||||||
const EMAIL = 'a@b.com';
|
const EMAIL = 'hole_thu@riseup.net';
|
||||||
|
|
||||||
export const TokenCtx = React.createContext({
|
export const TokenCtx = React.createContext({
|
||||||
value: null,
|
value: null,
|
||||||
@@ -39,6 +39,11 @@ export function InfoSidebar(props) {
|
|||||||
<PromotionBar />
|
<PromotionBar />
|
||||||
<LoginForm show_sidebar={props.show_sidebar} />
|
<LoginForm show_sidebar={props.show_sidebar} />
|
||||||
<div className="box list-menu">
|
<div className="box list-menu">
|
||||||
|
<a href="/about.html" target="_blank">
|
||||||
|
<span className="icon icon-textfile" />
|
||||||
|
<label>关于</label>
|
||||||
|
</a>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.show_sidebar('设置', <ConfigUI />);
|
props.show_sidebar('设置', <ConfigUI />);
|
||||||
@@ -52,14 +57,6 @@ export function InfoSidebar(props) {
|
|||||||
<span className="icon icon-textfile" />
|
<span className="icon icon-textfile" />
|
||||||
<label>树洞规范(试行)</label>
|
<label>树洞规范(试行)</label>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a
|
|
||||||
href={REPOSITORY+"/issues"}
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<span className="icon icon-github" />
|
|
||||||
<label>意见反馈</label>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="box help-desc-box">
|
<div className="box help-desc-box">
|
||||||
<p>
|
<p>
|
||||||
@@ -88,7 +85,8 @@ export function InfoSidebar(props) {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="box help-desc-box">
|
<div className="box help-desc-box">
|
||||||
<p>联系我们:<a href={"mailto:"+EMAIL}>{EMAIL}</a></p>
|
<p>意见反馈请加tag #意见反馈 或到github后端的issus区。</p>
|
||||||
|
<p>联系我们:<a href={"mailto:"+EMAIL}>{EMAIL}</a> 。</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="box help-desc-box">
|
<div className="box help-desc-box">
|
||||||
<p>
|
<p>
|
||||||
@@ -102,7 +100,7 @@ export function InfoSidebar(props) {
|
|||||||
<a href={REPOSITORY} target="_blank">
|
<a href={REPOSITORY} target="_blank">
|
||||||
GitHub
|
GitHub
|
||||||
</a>{' '}
|
</a>{' '}
|
||||||
开源
|
开源。
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
新T树洞 网页版基于
|
新T树洞 网页版基于
|
||||||
@@ -121,7 +119,7 @@ export function InfoSidebar(props) {
|
|||||||
<a href="https://icomoon.io/#icons" target="_blank" rel="noopener">
|
<a href="https://icomoon.io/#icons" target="_blank" rel="noopener">
|
||||||
IcoMoon
|
IcoMoon
|
||||||
</a>
|
</a>
|
||||||
等开源项目
|
等开源项目。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -118,7 +118,10 @@ export const API = {
|
|||||||
|
|
||||||
get_list: async (page, token) => {
|
get_list: async (page, token) => {
|
||||||
let response = await fetch(
|
let response = await fetch(
|
||||||
API_BASE + '/getlist' + token_param(token) + '&p=' + page,
|
API_BASE + '/getlist'
|
||||||
|
+ token_param(token)
|
||||||
|
+ '&p=' + page
|
||||||
|
+ (window.config.no_c_post ? '&no_cw' : '')
|
||||||
);
|
);
|
||||||
return handle_response(response);
|
return handle_response(response);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -310,4 +310,6 @@ a.button {
|
|||||||
|
|
||||||
min-width: 6em;
|
min-width: 6em;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
|
||||||
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,27 +76,30 @@ class LoginPopupSelf extends Component {
|
|||||||
<b>通过第三方验证登陆T大树洞</b>
|
<b>通过第三方验证登陆T大树洞</b>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a className="button" href="/_login?p=cs" target="_blank"
|
<a href="/_login?p=cs" target="_blank">
|
||||||
>
|
<span className="icon icon-login" />
|
||||||
闭社
|
闭社
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button type="button" disabled
|
<button type="button" disabled
|
||||||
>
|
>
|
||||||
T大树洞
|
<span className="icon icon-login" />
|
||||||
|
T大树洞
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button type="button" disabled
|
<button type="button" disabled
|
||||||
>
|
>
|
||||||
未名bbs
|
<span className="icon icon-login" />
|
||||||
|
未名bbs
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button type="button" disabled
|
<button type="button" disabled
|
||||||
>
|
>
|
||||||
清华统一身份认证
|
<span className="icon icon-login" />
|
||||||
|
清华统一身份认证
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
Reference in New Issue
Block a user