feat: room(分区)

This commit is contained in:
2022-08-19 10:01:32 +08:00
parent 2f8db7ce9d
commit 438bba8439
6 changed files with 21 additions and 6 deletions

View File

@@ -22,11 +22,12 @@ const BUILTIN_IMGS = {
const DEFAULT_CONFIG = {
background_img:
'//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',
background_color: '#113366',
pressure: false,
easter_egg: true,
color_scheme: 'default',
show_all_rooms: false,
block_tmp: true,
block_cw: ['xxg', 'zzxg'],
block_words_v4: ['🕷️', '[系统自动代发]'],
@@ -363,6 +364,13 @@ export class ConfigUI extends PureComponent {
callback={this.save_changes_bound}
/>
<hr />
<ConfigSwitch
callback={this.save_changes_bound}
id="show_all_rooms"
name="展示所有分区"
description="展示来自所有分区而非仅当前分区的洞"
/>
<hr />
<ConfigSwitch
callback={this.save_changes_bound}
id="block_tmp"

View File

@@ -294,6 +294,9 @@ class FlowItem extends PureComponent {
<code className="box-id">
<a href={'##' + info.pid} onClick={this.copy_link.bind(this)}>
#{info.pid}
{info.room_id !== parseInt(process.env.REACT_APP_ROOM_ID) && (
<> @{info.room_id}</>
)}
</a>
</code>
&nbsp;

View File

@@ -206,6 +206,7 @@ export function Title(props) {
}
>
新T树洞
<sup>{process.env.REACT_APP_ROOM_ID || '?'}</sup>
</span>
</p>
</div>

View File

@@ -588,7 +588,7 @@ export class PostForm extends Component {
text: text,
allow_search: allow_search ? '1' : '',
use_title: use_title ? '1' : '',
type: 'text',
room_id: process.env.REACT_APP_ROOM_ID,
});
if (has_poll) {
poll_options.forEach((opt) => {

View File

@@ -168,7 +168,9 @@ export const API = {
get_list: async (page, token, submode) => {
let response = await fetch(
`${get_api_base()}/getlist?p=${page}&order_mode=${submode}`,
`${get_api_base()}/getlist?p=${page}&order_mode=${submode}&room_id=${
window.config.show_all_rooms ? '' : process.env.REACT_APP_ROOM_ID
}`,
{
headers: { 'User-Token': token },
},
@@ -178,9 +180,9 @@ export const API = {
get_search: async (page, keyword, token, submode) => {
let response = await fetch(
`${get_api_base()}/search?search_mode=${submode}&page=${page}&keywords=${encodeURIComponent(
keyword,
)}&pagesize=${SEARCH_PAGESIZE}`,
`${get_api_base()}/search?search_mode=${submode}&page=${page}&room_id=${
window.config.show_all_rooms ? '' : process.env.REACT_APP_ROOM_ID
}&keywords=${encodeURIComponent(keyword)}&pagesize=${SEARCH_PAGESIZE}`,
{
headers: { 'User-Token': token },
},