From 438bba8439e7db2ceba9307a0c6441d9e094c6c8 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Fri, 19 Aug 2022 10:01:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20room=EF=BC=88=E5=88=86=E5=8C=BA?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 1 + src/Config.js | 10 +++++++++- src/Flows.js | 3 +++ src/Title.js | 1 + src/UserAction.js | 2 +- src/flows_api.js | 10 ++++++---- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5f81a15..e2d28bd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -22,6 +22,7 @@ jobs: - name: "Build" run: yarn build env: + REACT_APP_ROOM_ID: 1 REACT_APP_BACKEND: "https://api.hole-thu-qwertyuiop.xyz/" REACT_APP_STORAGE: "https://file.hole-thu-qwertyuiop.xyz/" REACT_APP_BUILD_INFO: "v-${{steps.date.outputs.date}}" diff --git a/src/Config.js b/src/Config.js index 87ea1b3..6ddbbc3 100644 --- a/src/Config.js +++ b/src/Config.js @@ -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} />
+ +
#{info.pid} + {info.room_id !== parseInt(process.env.REACT_APP_ROOM_ID) && ( + <> @{info.room_id} + )}   diff --git a/src/Title.js b/src/Title.js index f75f443..5558cac 100644 --- a/src/Title.js +++ b/src/Title.js @@ -206,6 +206,7 @@ export function Title(props) { } > ζ–°Tζ ‘ζ΄ž + {process.env.REACT_APP_ROOM_ID || '?'}

diff --git a/src/UserAction.js b/src/UserAction.js index e3f7250..32a39cf 100644 --- a/src/UserAction.js +++ b/src/UserAction.js @@ -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) => { diff --git a/src/flows_api.js b/src/flows_api.js index a32d343..e2d4856 100644 --- a/src/flows_api.js +++ b/src/flows_api.js @@ -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 }, },