feat: room(分区)
This commit is contained in:
1
.github/workflows/deploy.yml
vendored
1
.github/workflows/deploy.yml
vendored
@@ -22,6 +22,7 @@ jobs:
|
|||||||
- name: "Build"
|
- name: "Build"
|
||||||
run: yarn build
|
run: yarn build
|
||||||
env:
|
env:
|
||||||
|
REACT_APP_ROOM_ID: 1
|
||||||
REACT_APP_BACKEND: "https://api.hole-thu-qwertyuiop.xyz/"
|
REACT_APP_BACKEND: "https://api.hole-thu-qwertyuiop.xyz/"
|
||||||
REACT_APP_STORAGE: "https://file.hole-thu-qwertyuiop.xyz/"
|
REACT_APP_STORAGE: "https://file.hole-thu-qwertyuiop.xyz/"
|
||||||
REACT_APP_BUILD_INFO: "v-${{steps.date.outputs.date}}"
|
REACT_APP_BUILD_INFO: "v-${{steps.date.outputs.date}}"
|
||||||
|
|||||||
@@ -22,11 +22,12 @@ const BUILTIN_IMGS = {
|
|||||||
|
|
||||||
const DEFAULT_CONFIG = {
|
const DEFAULT_CONFIG = {
|
||||||
background_img:
|
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',
|
background_color: '#113366',
|
||||||
pressure: false,
|
pressure: false,
|
||||||
easter_egg: true,
|
easter_egg: true,
|
||||||
color_scheme: 'default',
|
color_scheme: 'default',
|
||||||
|
show_all_rooms: false,
|
||||||
block_tmp: true,
|
block_tmp: true,
|
||||||
block_cw: ['xxg', 'zzxg'],
|
block_cw: ['xxg', 'zzxg'],
|
||||||
block_words_v4: ['🕷️', '[系统自动代发]'],
|
block_words_v4: ['🕷️', '[系统自动代发]'],
|
||||||
@@ -363,6 +364,13 @@ export class ConfigUI extends PureComponent {
|
|||||||
callback={this.save_changes_bound}
|
callback={this.save_changes_bound}
|
||||||
/>
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
|
<ConfigSwitch
|
||||||
|
callback={this.save_changes_bound}
|
||||||
|
id="show_all_rooms"
|
||||||
|
name="展示所有分区"
|
||||||
|
description="展示来自所有分区而非仅当前分区的洞"
|
||||||
|
/>
|
||||||
|
<hr />
|
||||||
<ConfigSwitch
|
<ConfigSwitch
|
||||||
callback={this.save_changes_bound}
|
callback={this.save_changes_bound}
|
||||||
id="block_tmp"
|
id="block_tmp"
|
||||||
|
|||||||
@@ -294,6 +294,9 @@ class FlowItem extends PureComponent {
|
|||||||
<code className="box-id">
|
<code className="box-id">
|
||||||
<a href={'##' + info.pid} onClick={this.copy_link.bind(this)}>
|
<a href={'##' + info.pid} onClick={this.copy_link.bind(this)}>
|
||||||
#{info.pid}
|
#{info.pid}
|
||||||
|
{info.room_id !== parseInt(process.env.REACT_APP_ROOM_ID) && (
|
||||||
|
<> @{info.room_id}</>
|
||||||
|
)}
|
||||||
</a>
|
</a>
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ export function Title(props) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
新T树洞
|
新T树洞
|
||||||
|
<sup>{process.env.REACT_APP_ROOM_ID || '?'}</sup>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ export class PostForm extends Component {
|
|||||||
text: text,
|
text: text,
|
||||||
allow_search: allow_search ? '1' : '',
|
allow_search: allow_search ? '1' : '',
|
||||||
use_title: use_title ? '1' : '',
|
use_title: use_title ? '1' : '',
|
||||||
type: 'text',
|
room_id: process.env.REACT_APP_ROOM_ID,
|
||||||
});
|
});
|
||||||
if (has_poll) {
|
if (has_poll) {
|
||||||
poll_options.forEach((opt) => {
|
poll_options.forEach((opt) => {
|
||||||
|
|||||||
@@ -168,7 +168,9 @@ export const API = {
|
|||||||
|
|
||||||
get_list: async (page, token, submode) => {
|
get_list: async (page, token, submode) => {
|
||||||
let response = await fetch(
|
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 },
|
headers: { 'User-Token': token },
|
||||||
},
|
},
|
||||||
@@ -178,9 +180,9 @@ export const API = {
|
|||||||
|
|
||||||
get_search: async (page, keyword, token, submode) => {
|
get_search: async (page, keyword, token, submode) => {
|
||||||
let response = await fetch(
|
let response = await fetch(
|
||||||
`${get_api_base()}/search?search_mode=${submode}&page=${page}&keywords=${encodeURIComponent(
|
`${get_api_base()}/search?search_mode=${submode}&page=${page}&room_id=${
|
||||||
keyword,
|
window.config.show_all_rooms ? '' : process.env.REACT_APP_ROOM_ID
|
||||||
)}&pagesize=${SEARCH_PAGESIZE}`,
|
}&keywords=${encodeURIComponent(keyword)}&pagesize=${SEARCH_PAGESIZE}`,
|
||||||
{
|
{
|
||||||
headers: { 'User-Token': token },
|
headers: { 'User-Token': token },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user