diff --git a/src/Config.js b/src/Config.js
index 8ad66d5..aa3fde2 100644
--- a/src/Config.js
+++ b/src/Config.js
@@ -3,8 +3,10 @@ import React, { PureComponent } from 'react';
import './Config.css';
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://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':
@@ -23,7 +25,7 @@ const BUILTIN_IMGS = {
const DEFAULT_CONFIG = {
background_img:
- 'https://www.tsinghua.edu.cn/images/footer.jpg',
+ '//cdn.jsdelivr.net/gh/thuhole/webhole@gh-pages/static/bg/gbp.jpg',
background_color: '#113366',
pressure: false,
easter_egg: true,
@@ -452,10 +454,10 @@ export class ConfigUI extends PureComponent {
@@ -1170,7 +1173,7 @@ export class Flow extends PureComponent {
}));
})
.catch(failed);
- } else if (this.state.mode === 'search') {
+ } else if (this.state.mode === 'search' && this.state.search_param) {
API.get_search(page, this.state.search_param, this.props.token)
.then((json) => {
const finished = json.data.length === 0;
diff --git a/src/Message.js b/src/Message.js
index 453c363..8474f6a 100644
--- a/src/Message.js
+++ b/src/Message.js
@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react';
-import { Time } from './Common';
+import { Time, API_BASE } from './Common';
import { get_json } from './infrastructure/functions';
import './Message.css';
@@ -26,7 +26,7 @@ export class MessageViewer extends PureComponent {
},
() => {
fetch(
- '/_api/v1/systemlog',
+ API_BASE + '/systemlog',
{
headers: {'User-Token': this.props.token},
}
diff --git a/src/Title.js b/src/Title.js
index 9e30472..bba77b1 100644
--- a/src/Title.js
+++ b/src/Title.js
@@ -136,7 +136,7 @@ class ControlBar extends PureComponent {
className="control-search"
value={this.state.search_text}
placeholder={
- this.props.mode === 'attention' ? '在关注列表中搜索' : '搜tag或 #树洞号, 如: 新手导引'}
+ this.props.mode === 'attention' ? '在关注列表中搜索' : '关键词 / tag / #树洞号'}
onChange={this.on_change_bound}
onKeyPress={this.on_keypress_bound}
/>
diff --git a/src/UserAction.css b/src/UserAction.css
index 6f73792..e7c49a4 100644
--- a/src/UserAction.css
+++ b/src/UserAction.css
@@ -40,6 +40,7 @@
.post-form-bar label {
flex: 1;
+ margin: 0 0.5rem;
}
.post-form-bar input[type=file] {
diff --git a/src/UserAction.js b/src/UserAction.js
index df7cc8c..db18ea3 100644
--- a/src/UserAction.js
+++ b/src/UserAction.js
@@ -24,7 +24,7 @@ const MAX_IMG_DIAM = 8000;
const MAX_IMG_PX = 5000000;
const MAX_IMG_FILESIZE = 450000 * BASE64_RATE;
-const REPOSITORY = 'https://github.com/newthuhole';
+const REPOSITORY = 'https://git.thu.monster/newthuhole/';
const EMAIL = 'hole_thu@riseup.net';
export const TokenCtx = React.createContext({
@@ -99,7 +99,7 @@ export function InfoSidebar(props) {
协议在{' '}
- GitHub
+ Gitea
{' '}
开源。
@@ -260,6 +260,7 @@ export class ReplyForm extends Component {
on_submit(event) {
if (event) event.preventDefault();
if (this.state.loading_status === 'loading') return;
+ if (!this.state.text) return;
this.setState({
loading_status: 'loading',
});
@@ -362,6 +363,7 @@ export class PostForm extends Component {
this.state = {
text: '',
cw: '',
+ allow_search: false,
loading_status: 'done',
img_tip: null,
preview: false,
@@ -369,6 +371,7 @@ export class PostForm extends Component {
this.img_ref = React.createRef();
this.area_ref = React.createRef();
this.on_change_bound = this.on_change.bind(this);
+ this.on_allow_search_change_bound = this.on_allow_search_change.bind(this);
this.on_cw_change_bound = this.on_cw_change.bind(this);
this.on_img_change_bound = this.on_img_change.bind(this);
this.color_picker = new ColorPicker();
@@ -378,6 +381,12 @@ export class PostForm extends Component {
if (this.area_ref.current) this.area_ref.current.focus();
}
+ on_allow_search_change(event) {
+ this.setState({
+ allow_search: event.target.checked,
+ });
+ }
+
on_cw_change(event) {
this.setState({
cw: event.target.value,
@@ -394,6 +403,7 @@ export class PostForm extends Component {
let data = new URLSearchParams();
data.append('cw', this.state.cw);
data.append('text', this.state.text);
+ data.append('allow_search', this.state.allow_search ? '1' : '');
data.append('type', img ? 'image' : 'text');
if (img) data.append('data', img);
@@ -547,6 +557,7 @@ export class PostForm extends Component {
on_submit(event) {
if (event) event.preventDefault();
if (this.state.loading_status === 'loading') return;
+ if (!this.state.text) return;
/*
if (this.img_ref.current.files.length) {
this.setState({
@@ -628,6 +639,15 @@ export class PostForm extends Component {
发表
)}
+
+
+
{!!this.state.img_tip && (