bump everything
* create-react-app 5.0.1 * many other dependencies * yarn 3.2.2 with Zero-Installs * fix eslint
This commit is contained in:
@@ -128,7 +128,7 @@ class App extends Component {
|
||||
<div className="box box-tip">
|
||||
<LoginPopup token_callback={token.set_value}>
|
||||
{(do_popup) => (
|
||||
<a onClick={do_popup}>
|
||||
<a href="###" onClick={do_popup}>
|
||||
<span className="icon icon-login" />
|
||||
登录到 新T树洞
|
||||
</a>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
.ext-img__warpper.loading {
|
||||
min-height: 100px;
|
||||
background: url('/static/loading.gif') center no-repeat;
|
||||
background: url('images/loading.gif') center no-repeat;
|
||||
background-size: 25px 25px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -379,6 +379,7 @@ export function PromotionBar(props) {
|
||||
把网页版树洞{' '}
|
||||
<b>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
if (pwa_prompt_event) pwa_prompt_event.prompt();
|
||||
}}
|
||||
|
||||
@@ -6,8 +6,6 @@ const BUILTIN_IMGS = {
|
||||
'https://cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/gbp.jpg':
|
||||
'怀旧背景(默认)',
|
||||
'https://www.tsinghua.edu.cn/image/nav-bg.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/yurucamp.jpg':
|
||||
@@ -334,12 +332,16 @@ export class ConfigUI extends PureComponent {
|
||||
<div className="box config-ui-header">
|
||||
<p>
|
||||
这些功能仍在测试,可能不稳定(
|
||||
<a onClick={this.reset_settings.bind(this)}>全部重置</a>)
|
||||
<a href="###" onClick={this.reset_settings.bind(this)}>
|
||||
全部重置
|
||||
</a>
|
||||
)
|
||||
</p>
|
||||
<p>
|
||||
<b>
|
||||
部分设置修改后需要{' '}
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
window.location.reload();
|
||||
}}
|
||||
|
||||
35
src/Flows.js
35
src/Flows.js
@@ -82,7 +82,10 @@ function load_single_meta(show_sidebar, token) {
|
||||
title_elem,
|
||||
<div className="box box-tip">
|
||||
<p>
|
||||
<a onClick={() => load_single_meta(show_sidebar, token)(pid, true)}>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => load_single_meta(show_sidebar, token)(pid, true)}
|
||||
>
|
||||
重新加载
|
||||
</a>
|
||||
</p>
|
||||
@@ -95,10 +98,6 @@ function load_single_meta(show_sidebar, token) {
|
||||
}
|
||||
|
||||
class Reply extends PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
info,
|
||||
@@ -550,7 +549,7 @@ class FlowSidebar extends PureComponent {
|
||||
report(event, text = '') {
|
||||
console.log(text);
|
||||
let reason = prompt(`举报 #${this.state.info.pid} 的理由:`, text);
|
||||
let should_hide = confirm('是否认为此洞应该被删除或隐藏?');
|
||||
let should_hide = window.confirm('是否认为此洞应该被删除或隐藏?');
|
||||
if (reason !== null) {
|
||||
API.report(this.state.info.pid, reason, should_hide, this.props.token)
|
||||
.then((json) => {
|
||||
@@ -564,7 +563,7 @@ class FlowSidebar extends PureComponent {
|
||||
}
|
||||
|
||||
block(name, type, id, on_complete) {
|
||||
if (confirm(`确定拉黑${name}吗?后续将不会收到其发布的任何内容`)) {
|
||||
if (window.confirm(`确定拉黑${name}吗?后续将不会收到其发布的任何内容`)) {
|
||||
API.block(type, id, this.props.token)
|
||||
.then((json) => {
|
||||
let data = json.data;
|
||||
@@ -707,21 +706,21 @@ class FlowSidebar extends PureComponent {
|
||||
<div className="box box-tip">
|
||||
{!!this.props.token && (
|
||||
<span>
|
||||
<a onClick={this.report.bind(this)}>
|
||||
<a href="###" onClick={this.report.bind(this)}>
|
||||
<span className="icon icon-flag" />
|
||||
<label>举报</label>
|
||||
</a>
|
||||
|
||||
</span>
|
||||
)}
|
||||
<a onClick={this.load_replies.bind(this)}>
|
||||
<a href="###" onClick={this.load_replies.bind(this)}>
|
||||
<span className="icon icon-refresh" />
|
||||
<label>刷新</label>
|
||||
</a>
|
||||
{(this.state.replies.length >= 1 || this.state.rev) && (
|
||||
<span>
|
||||
|
||||
<a onClick={this.toggle_rev.bind(this)}>
|
||||
<a href="###" onClick={this.toggle_rev.bind(this)}>
|
||||
<span className="icon icon-order-rev" />
|
||||
<label>{this.state.rev ? '还原' : '逆序'}</label>
|
||||
</a>
|
||||
@@ -731,6 +730,7 @@ class FlowSidebar extends PureComponent {
|
||||
<span>
|
||||
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
this.toggle_attention();
|
||||
}}
|
||||
@@ -755,6 +755,7 @@ class FlowSidebar extends PureComponent {
|
||||
<p>
|
||||
<span style={{ float: 'left' }}>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
this.set_filter_name(null);
|
||||
}}
|
||||
@@ -859,8 +860,8 @@ class FlowItemRow extends PureComponent {
|
||||
super(props);
|
||||
this.needFold =
|
||||
props.info.cw &&
|
||||
window.config.whitelist_cw.indexOf('*') == -1 &&
|
||||
window.config.whitelist_cw.indexOf(props.info.cw) == -1 &&
|
||||
window.config.whitelist_cw.indexOf('*') === -1 &&
|
||||
window.config.whitelist_cw.indexOf(props.info.cw) === -1 &&
|
||||
props.mode === 'list';
|
||||
this.has_block_words = check_block(props.info);
|
||||
this.color_picker = new ColorPicker();
|
||||
@@ -1011,6 +1012,7 @@ class FlowItemRow extends PureComponent {
|
||||
<div className="box box-tip">
|
||||
<p>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
this.load_replies();
|
||||
}}
|
||||
@@ -1179,7 +1181,9 @@ class FlowItemQuote extends PureComponent {
|
||||
<div className="aux-margin">
|
||||
<div className="box box-tip">
|
||||
<p>
|
||||
<a onClick={this.load.bind(this)}>重新加载</a>
|
||||
<a href="###" onClick={this.load.bind(this)}>
|
||||
重新加载
|
||||
</a>
|
||||
</p>
|
||||
<p>{this.state.error_msg}</p>
|
||||
</div>
|
||||
@@ -1266,8 +1270,9 @@ export class Flow extends PureComponent {
|
||||
return ['线上关注', '本地收藏'];
|
||||
case 'search':
|
||||
return ['Tag搜索', '全文搜索', '头衔'];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
set_submode(submode) {
|
||||
@@ -1285,6 +1290,7 @@ export class Flow extends PureComponent {
|
||||
<div className="aux-margin flow-submode-choice">
|
||||
{submode_names.map((name, idx) => (
|
||||
<a
|
||||
href="###"
|
||||
key={idx}
|
||||
className={submode === idx ? 'choiced' : ''}
|
||||
onClick={this.set_submode.bind(this, idx)}
|
||||
@@ -1590,6 +1596,7 @@ class SubFlow extends PureComponent {
|
||||
<div className="box box-tip">
|
||||
<p>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
this.load_page(this.state.loaded_pages + 1);
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import MarkdownIt from 'markdown-it';
|
||||
import MarkdownItKaTeX from 'markdown-it-katex';
|
||||
import MarkdownItKaTeX from '@traptitech/markdown-it-katex';
|
||||
import hljs from 'highlight.js';
|
||||
import 'highlight.js/styles/atom-one-dark.css';
|
||||
import './Markdown.css';
|
||||
@@ -30,4 +30,6 @@ let md = new MarkdownIt({
|
||||
errorColor: '#aa0000',
|
||||
});
|
||||
|
||||
export default (text) => md.render(text);
|
||||
export default function renderMarkdown(text) {
|
||||
return md.render(text);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ export class MessageViewer extends PureComponent {
|
||||
return (
|
||||
<div className="box box-tip">
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
this.load();
|
||||
}}
|
||||
|
||||
@@ -52,13 +52,13 @@ export class Sidebar extends PureComponent {
|
||||
/>
|
||||
<div className="sidebar">{contents}</div>
|
||||
<div className="sidebar-title">
|
||||
<a className="no-underline" onClick={this.do_close_bound}>
|
||||
<a href="###" className="no-underline" onClick={this.do_close_bound}>
|
||||
|
||||
<span className="icon icon-close" />
|
||||
|
||||
</a>
|
||||
{this.props.stack.length > 2 && (
|
||||
<a className="no-underline" onClick={this.do_back_bound}>
|
||||
<a href="###" className="no-underline" onClick={this.do_back_bound}>
|
||||
|
||||
<span className="icon icon-back" />
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class ControlBar extends PureComponent {
|
||||
let text = decodeURIComponent(window.location.hash).substr(1);
|
||||
if (text.lastIndexOf('?') !== -1)
|
||||
text = text.substr(0, text.lastIndexOf('?')); // fuck wechat '#param?nsukey=...'
|
||||
if (text === '##') return;
|
||||
this.setState(
|
||||
{
|
||||
search_text: text,
|
||||
@@ -40,7 +41,7 @@ class ControlBar extends PureComponent {
|
||||
'hashchange',
|
||||
() => {
|
||||
let text = decodeURIComponent(window.location.hash).substr(1);
|
||||
if (text && text[0] != '#') {
|
||||
if (text && text[0] !== '#') {
|
||||
console.log('search', text);
|
||||
this.setState(
|
||||
{
|
||||
@@ -118,6 +119,7 @@ class ControlBar extends PureComponent {
|
||||
{({ value: token }) => (
|
||||
<div className="control-bar">
|
||||
<a
|
||||
href="###"
|
||||
className="no-underline control-btn"
|
||||
onClick={this.do_refresh_bound}
|
||||
>
|
||||
@@ -126,6 +128,7 @@ class ControlBar extends PureComponent {
|
||||
</a>
|
||||
{!!token && (
|
||||
<a
|
||||
href="###"
|
||||
className="no-underline control-btn"
|
||||
onClick={this.do_attention_bound}
|
||||
>
|
||||
@@ -145,6 +148,7 @@ class ControlBar extends PureComponent {
|
||||
onKeyPress={this.on_keypress_bound}
|
||||
/>
|
||||
<a
|
||||
href="###"
|
||||
className="no-underline control-btn"
|
||||
onClick={() => {
|
||||
this.props.show_sidebar(
|
||||
@@ -160,6 +164,7 @@ class ControlBar extends PureComponent {
|
||||
</a>
|
||||
{!!token && (
|
||||
<a
|
||||
href="###"
|
||||
className="no-underline control-btn"
|
||||
onClick={() => {
|
||||
this.props.show_sidebar(
|
||||
|
||||
@@ -38,6 +38,7 @@ export function InfoSidebar(props) {
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
props.show_sidebar('设置', <ConfigUI />);
|
||||
}}
|
||||
@@ -57,6 +58,7 @@ export function InfoSidebar(props) {
|
||||
<div className="box help-desc-box">
|
||||
<p>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
@@ -226,6 +228,7 @@ export class LoginForm extends Component {
|
||||
</p>
|
||||
<p>
|
||||
<a
|
||||
href="###"
|
||||
onClick={() => {
|
||||
this.props.show_sidebar(
|
||||
'系统日志',
|
||||
@@ -239,7 +242,10 @@ export class LoginForm extends Component {
|
||||
举报记录、管理日志等都是公开的。
|
||||
</p>
|
||||
<p>
|
||||
<a onClick={this.copy_token.bind(this, token.value)}>
|
||||
<a
|
||||
href="###"
|
||||
onClick={this.copy_token.bind(this, token.value)}
|
||||
>
|
||||
复制 User Token
|
||||
</a>
|
||||
<br />
|
||||
@@ -344,9 +350,8 @@ export class ReplyForm extends Component {
|
||||
this.on_change_bound = this.on_change.bind(this);
|
||||
this.on_use_title_change_bound = this.on_use_title_change.bind(this);
|
||||
this.area_ref = this.props.area_ref || React.createRef();
|
||||
this.global_keypress_handler_bound = this.global_keypress_handler.bind(
|
||||
this,
|
||||
);
|
||||
this.global_keypress_handler_bound =
|
||||
this.global_keypress_handler.bind(this);
|
||||
this.color_picker = new ColorPicker();
|
||||
}
|
||||
|
||||
@@ -568,14 +573,8 @@ export class PostForm extends Component {
|
||||
}
|
||||
|
||||
do_post() {
|
||||
const {
|
||||
cw,
|
||||
text,
|
||||
allow_search,
|
||||
use_title,
|
||||
has_poll,
|
||||
poll_options,
|
||||
} = this.state;
|
||||
const { cw, text, allow_search, use_title, has_poll, poll_options } =
|
||||
this.state;
|
||||
let data = new URLSearchParams({
|
||||
cw: cw,
|
||||
text: text,
|
||||
@@ -626,12 +625,10 @@ export class PostForm extends Component {
|
||||
if (event) event.preventDefault();
|
||||
if (this.state.loading_status === 'loading') return;
|
||||
if (!this.state.text) return;
|
||||
{
|
||||
this.setState({
|
||||
loading_status: 'loading',
|
||||
});
|
||||
this.do_post();
|
||||
}
|
||||
this.setState({
|
||||
loading_status: 'loading',
|
||||
});
|
||||
this.do_post();
|
||||
}
|
||||
|
||||
toggle_preview() {
|
||||
@@ -702,7 +699,7 @@ export class PostForm extends Component {
|
||||
upload_complete(event) {
|
||||
try {
|
||||
let j = JSON.parse(event.target.responseText);
|
||||
if (j.code != 0) {
|
||||
if (j.code !== 0) {
|
||||
alert(j.msg);
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
BIN
src/images/loading.gif
Normal file
BIN
src/images/loading.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import './index.css';
|
||||
import './fonts_7/icomoon.css';
|
||||
import App from './App';
|
||||
@@ -7,6 +6,8 @@ import App from './App';
|
||||
import registerServiceWorker from './registerServiceWorker';
|
||||
|
||||
//elevate();
|
||||
const container = document.getElementById('root');
|
||||
const root = createRoot(container); // createRoot(container!) if you use TypeScript
|
||||
root.render(<App tab="home" />);
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
registerServiceWorker();
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
// regexp should match the WHOLE segmented part
|
||||
// export const PID_RE=/(^|[^\d\u20e3\ufe0e\ufe0f])([2-9]\d{4,5}|1\d{4,6})(?![\d\u20e3\ufe0e\ufe0f])/g;
|
||||
export const PID_RE = /(^|[^\d\u20e3\ufe0e\ufe0f])(#\d{1,7})(?![\d\u20e3\ufe0e\ufe0f])/g;
|
||||
export const PID_RE =
|
||||
/(^|[^\d\u20e3\ufe0e\ufe0f])(#\d{1,7})(?![\d\u20e3\ufe0e\ufe0f])/g;
|
||||
// TODO: fix this re
|
||||
// export const URL_PID_RE=/((?:https?:\/\/)?thuhole\.com\/?#(?:#|%23)([2-9]\d{4,5}|1\d{4,6}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
||||
export const URL_PID_RE = /(https:\/\/thuhollow\.github\.io\/?#(?:#|%23)(?:\d{1,7}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
||||
export const NICKNAME_RE = /(^|[^A-Za-z])((?:(?:(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach) )*(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach))|洞主)(?![A-Za-z])/gi;
|
||||
export const URL_RE = /(^|[^.@a-zA-Z0-9_])(https?:\/\/(?:(?:[\w-]+\.)+[a-zA-Z]{2,9}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,5})(?::\d{1,5})?(?:\/[\w~!@#$%^&*()\-_=+[\]{};:,./?|]*)?)(?![a-zA-Z0-9])/gi;
|
||||
export const URL_PID_RE =
|
||||
/(https:\/\/thuhollow\.github\.io\/?#(?:#|%23)(?:\d{1,7}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
||||
export const NICKNAME_RE =
|
||||
/(^|[^A-Za-z])((?:(?:(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach) )*(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach))|洞主)(?![A-Za-z])/gi;
|
||||
export const URL_RE =
|
||||
/(^|[^.@a-zA-Z0-9_])(https?:\/\/(?:(?:[\w-]+\.)+[a-zA-Z]{2,9}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,5})(?::\d{1,5})?(?:\/[\w~!@#$%^&*()\-_=+[\]{};:,./?|]*)?)(?![a-zA-Z0-9])/gi;
|
||||
|
||||
export const TAG_RE = /(^|\s)(#[^#\s]{1,32})($|\s|#)/g;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user