From 92c26911df001a797355686efd61cc9cd1c5b2f8 Mon Sep 17 00:00:00 2001 From: czy0729 <402731062@qq.com> Date: Mon, 9 Sep 2024 21:43:18 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E7=A7=BB=E9=99=A4=E5=BA=9F=E5=BC=83=20db?= =?UTF-8?q?=20=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/constants/app.ts | 5 +-- src/screens/discovery/anime/store/computed.ts | 4 +- src/screens/discovery/game/store/computed.ts | 4 +- src/screens/discovery/hentai/store.ts | 4 +- src/screens/discovery/manga/store/computed.ts | 4 +- src/screens/discovery/nsfw/store/computed.ts | 4 +- src/screens/discovery/wenku/store.ts | 4 +- src/screens/login/v2/ds.ts | 8 +--- src/screens/login/v2/index.tsx | 12 +++--- src/screens/tinygrail/advance-ask/store.ts | 12 +++--- .../tinygrail/advance-auction/store.ts | 14 +++---- .../tinygrail/advance-auction2/store.ts | 14 +++---- src/screens/tinygrail/advance-bid/store.ts | 12 +++--- .../tinygrail/advance-sacrifice/store.ts | 6 +-- src/screens/tinygrail/advance-state/store.ts | 12 +++--- .../tinygrail/index/component/auth/index.tsx | 4 +- src/screens/tinygrail/index/store.ts | 22 +++------- .../user/dev/{ => components}/base/index.tsx | 31 +++++++++----- .../user/dev/{ => components}/base/styles.ts | 0 .../dev/{ => components}/detail/block.tsx | 0 .../dev/{ => components}/detail/index.tsx | 0 .../dev/{ => components}/detail/styles.ts | 0 .../screen-orientation/index.tsx | 8 +++- .../{ => components}/update-advance/index.tsx | 41 ++++++------------- .../{ => components}/update-advance/styles.ts | 0 .../dev/{ => components}/update-key/index.tsx | 0 .../dev/{ => components}/update-key/styles.ts | 0 .../{ => components}/update-tourist/index.tsx | 24 ++++------- .../{ => components}/update-tourist/styles.ts | 0 .../{ => components}/update-tourist/utils.ts | 0 .../{ => components}/users-advance/index.tsx | 22 ++++------ .../{ => components}/users-advance/styles.ts | 0 .../{ => components}/users-advance/utils.ts | 0 src/screens/user/dev/index.tsx | 23 ++++------- .../setting/component/cdn/cdn-avatar/utils.ts | 6 +-- .../setting/component/cdn/cdn-cover/utils.ts | 6 +-- src/screens/user/sponsor/ds.ts | 8 ++-- src/screens/user/sponsor/store.ts | 6 +-- src/screens/user/sponsor/utils.ts | 8 ++-- src/screens/user/user-setting/ds.ts | 4 -- src/screens/user/user-setting/store/fetch.ts | 8 ++-- src/stores/tinygrail/computed.ts | 8 +--- src/stores/tinygrail/fetch.ts | 29 +------------ src/stores/tinygrail/index.ts | 3 +- src/stores/tinygrail/init.ts | 6 +-- src/utils/fetch.v0/index.ts | 18 ++------ 46 files changed, 147 insertions(+), 257 deletions(-) rename src/screens/user/dev/{ => components}/base/index.tsx (63%) rename src/screens/user/dev/{ => components}/base/styles.ts (100%) rename src/screens/user/dev/{ => components}/detail/block.tsx (100%) rename src/screens/user/dev/{ => components}/detail/index.tsx (100%) rename src/screens/user/dev/{ => components}/detail/styles.ts (100%) rename src/screens/user/dev/{ => components}/screen-orientation/index.tsx (78%) rename src/screens/user/dev/{ => components}/update-advance/index.tsx (75%) rename src/screens/user/dev/{ => components}/update-advance/styles.ts (100%) rename src/screens/user/dev/{ => components}/update-key/index.tsx (100%) rename src/screens/user/dev/{ => components}/update-key/styles.ts (100%) rename src/screens/user/dev/{ => components}/update-tourist/index.tsx (79%) rename src/screens/user/dev/{ => components}/update-tourist/styles.ts (100%) rename src/screens/user/dev/{ => components}/update-tourist/utils.ts (100%) rename src/screens/user/dev/{ => components}/users-advance/index.tsx (75%) rename src/screens/user/dev/{ => components}/users-advance/styles.ts (100%) rename src/screens/user/dev/{ => components}/users-advance/utils.ts (100%) diff --git a/src/constants/constants/app.ts b/src/constants/constants/app.ts index c9726c3c8..5e10df9ac 100644 --- a/src/constants/constants/app.ts +++ b/src/constants/constants/app.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2024-09-02 11:54:41 * @Last Modified by: czy0729 - * @Last Modified time: 2024-09-09 16:35:06 + * @Last Modified time: 2024-09-09 20:42:09 */ /** App ID https://bgm.tv/dev/app */ @@ -52,6 +52,3 @@ export const GITHUB_RELEASE_REPOS = 'https://api.github.com/repos/czy0729/Bangum /** @deprecated */ export const GITHUB_HOST = 'https://gitee.com/a296377710/bangumi-pro' - -/** @deprecated 高级会员地址 */ -export const GITHUB_ADVANCE = `${GITHUB_HOST}/raw/master/advance.json` diff --git a/src/screens/discovery/anime/store/computed.ts b/src/screens/discovery/anime/store/computed.ts index 81773844c..0fb531a7c 100644 --- a/src/screens/discovery/anime/store/computed.ts +++ b/src/screens/discovery/anime/store/computed.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2024-07-25 06:12:20 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-25 07:00:42 + * @Last Modified time: 2024-09-09 20:37:09 */ import { computed } from 'mobx' import { collectionStore, otaStore, systemStore } from '@stores' @@ -32,7 +32,7 @@ export default class Computed extends State { } if (!systemStore.advance) { - list = list.filter((item, index) => index < ADVANCE_LIMIT) + list = list.filter((_item, index) => index < ADVANCE_LIMIT) } return list diff --git a/src/screens/discovery/game/store/computed.ts b/src/screens/discovery/game/store/computed.ts index 35d1dc162..c3bc14c3b 100644 --- a/src/screens/discovery/game/store/computed.ts +++ b/src/screens/discovery/game/store/computed.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2024-07-25 20:31:00 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-25 21:23:12 + * @Last Modified time: 2024-09-09 20:37:04 */ import { computed } from 'mobx' import { collectionStore, otaStore, systemStore } from '@stores' @@ -32,7 +32,7 @@ export default class Computed extends State { } if (!systemStore.advance) { - list = list.filter((item, index) => index < ADVANCE_LIMIT) + list = list.filter((_item, index) => index < ADVANCE_LIMIT) } return list diff --git a/src/screens/discovery/hentai/store.ts b/src/screens/discovery/hentai/store.ts index 87e6e9566..8fd6236ff 100755 --- a/src/screens/discovery/hentai/store.ts +++ b/src/screens/discovery/hentai/store.ts @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-06-22 15:38:18 * @Last Modified by: czy0729 - * @Last Modified time: 2023-12-17 08:32:12 + * @Last Modified time: 2024-09-09 20:37:00 */ import { computed, observable } from 'mobx' import { collectionStore, otaStore, systemStore, userStore } from '@stores' @@ -90,7 +90,7 @@ export default class ScreenHentai extends store { } if (!systemStore.advance) { - list = list.filter((item, index) => index < ADVANCE_LIMIT) + list = list.filter((_item, index) => index < ADVANCE_LIMIT) } return list diff --git a/src/screens/discovery/manga/store/computed.ts b/src/screens/discovery/manga/store/computed.ts index 742f035ca..1fb9926ec 100644 --- a/src/screens/discovery/manga/store/computed.ts +++ b/src/screens/discovery/manga/store/computed.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2024-07-26 05:07:29 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-26 05:18:04 + * @Last Modified time: 2024-09-09 20:36:10 */ import { computed } from 'mobx' import { collectionStore, otaStore, systemStore } from '@stores' @@ -32,7 +32,7 @@ export default class Computed extends State { } if (!systemStore.advance) { - list = list.filter((item, index) => index < ADVANCE_LIMIT) + list = list.filter((_item, index) => index < ADVANCE_LIMIT) } return list diff --git a/src/screens/discovery/nsfw/store/computed.ts b/src/screens/discovery/nsfw/store/computed.ts index 3488626fd..6206ff9a6 100644 --- a/src/screens/discovery/nsfw/store/computed.ts +++ b/src/screens/discovery/nsfw/store/computed.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2024-07-20 10:35:12 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-20 11:23:13 + * @Last Modified time: 2024-09-09 20:36:04 */ import { computed } from 'mobx' import { collectionStore, otaStore, systemStore } from '@stores' @@ -33,7 +33,7 @@ export default class Computed extends State { } if (!systemStore.advance) { - list = list.filter((item, index) => index < ADVANCE_LIMIT) + list = list.filter((_item, index) => index < ADVANCE_LIMIT) } return list diff --git a/src/screens/discovery/wenku/store.ts b/src/screens/discovery/wenku/store.ts index c4a4f27a0..121156add 100755 --- a/src/screens/discovery/wenku/store.ts +++ b/src/screens/discovery/wenku/store.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2020-09-03 10:44:02 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-26 13:31:42 + * @Last Modified time: 2024-09-09 20:35:55 */ import { computed, observable } from 'mobx' import { collectionStore, otaStore, systemStore } from '@stores' @@ -74,7 +74,7 @@ export default class ScreenWenku extends store { } if (!systemStore.advance) { - list = list.filter((item, index) => index < ADVANCE_LIMIT) + list = list.filter((_item, index) => index < ADVANCE_LIMIT) } return list diff --git a/src/screens/login/v2/ds.ts b/src/screens/login/v2/ds.ts index d5ab2291a..e9e6af4e6 100644 --- a/src/screens/login/v2/ds.ts +++ b/src/screens/login/v2/ds.ts @@ -2,19 +2,13 @@ * @Author: czy0729 * @Date: 2023-06-27 10:01:16 * @Last Modified by: czy0729 - * @Last Modified time: 2023-06-27 10:04:54 + * @Last Modified time: 2024-09-09 21:09:41 */ -import { getTimestamp } from '@utils' -import { GITHUB_HOST } from '@constants' - export const TITLE = '登录' export const NAMESPACE = 'LoginV2' export const AUTH_RETRY_COUNT = 4 -export const URL_TOURIST = - `${GITHUB_HOST}/raw/master/tourist.json?t=${getTimestamp()}` as const - export const UA_EKIBUN_BANGUMI_APP = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36' diff --git a/src/screens/login/v2/index.tsx b/src/screens/login/v2/index.tsx index d38b18b13..7eb5723f9 100755 --- a/src/screens/login/v2/index.tsx +++ b/src/screens/login/v2/index.tsx @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-06-30 15:48:46 * @Last Modified by: czy0729 - * @Last Modified time: 2024-09-02 15:56:50 + * @Last Modified time: 2024-09-09 21:09:31 */ import React from 'react' import { View } from 'react-native' @@ -22,7 +22,8 @@ import { urlStringify } from '@utils' import { ob } from '@utils/decorators' -import { hm, queue, t, xhrCustom } from '@utils/fetch' +import { hm, queue, t } from '@utils/fetch' +import { get } from '@utils/kv' import axios from '@utils/thirdParty/axios' import { APP_ID, @@ -38,7 +39,7 @@ import { HOST_PROXY } from '@/config' import { Navigation } from '@types' import Form from './form' import Preview from './preview' -import { AUTH_RETRY_COUNT, NAMESPACE, UA_EKIBUN_BANGUMI_APP, URL_TOURIST } from './ds' +import { AUTH_RETRY_COUNT, NAMESPACE, UA_EKIBUN_BANGUMI_APP } from './ds' import { memoStyles } from './styles' /** 账号密码登录 */ @@ -104,10 +105,7 @@ class LoginV2 extends React.Component<{ try { info('正在从github获取游客cookie...') - const { _response } = await xhrCustom({ - url: URL_TOURIST - }) - const { accessToken, userCookie } = JSON.parse(_response) + const { accessToken, userCookie } = await get('tourist') userStore.updateAccessToken(accessToken) const { navigation } = this.props diff --git a/src/screens/tinygrail/advance-ask/store.ts b/src/screens/tinygrail/advance-ask/store.ts index c441b6d3d..92f9f29e8 100755 --- a/src/screens/tinygrail/advance-ask/store.ts +++ b/src/screens/tinygrail/advance-ask/store.ts @@ -2,10 +2,10 @@ * @Author: czy0729 * @Date: 2020-01-08 11:42:58 * @Last Modified by: czy0729 - * @Last Modified time: 2022-11-08 05:47:31 + * @Last Modified time: 2024-09-09 20:31:20 */ -import { observable, computed } from 'mobx' -import { tinygrailStore, userStore } from '@stores' +import { computed, observable } from 'mobx' +import { systemStore, tinygrailStore, userStore } from '@stores' import { getTimestamp, info } from '@utils' import store from '@utils/store' import { DEV } from '@constants' @@ -50,7 +50,7 @@ export default class ScreenTinygrailAdvanceAsk extends store { } @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get advanceList() { @@ -76,9 +76,7 @@ export default class ScreenTinygrailAdvanceAsk extends store { @computed get levelMap() { const { list } = this.advanceList const data = {} - list.forEach(item => - data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1) - ) + list.forEach(item => (data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1))) return data } diff --git a/src/screens/tinygrail/advance-auction/store.ts b/src/screens/tinygrail/advance-auction/store.ts index a55ba9f27..72398134e 100755 --- a/src/screens/tinygrail/advance-auction/store.ts +++ b/src/screens/tinygrail/advance-auction/store.ts @@ -2,14 +2,14 @@ * @Author: czy0729 * @Date: 2020-01-09 19:43:29 * @Last Modified by: czy0729 - * @Last Modified time: 2022-11-08 05:56:01 + * @Last Modified time: 2024-09-09 20:27:32 */ -import { observable, computed } from 'mobx' -import { tinygrailStore, userStore } from '@stores' +import { computed, observable } from 'mobx' +import { systemStore, tinygrailStore, userStore } from '@stores' import { getTimestamp, info } from '@utils' import store from '@utils/store' import { DEV } from '@constants' -import { levelList, sortList, SORT_GF } from '@tinygrail/_/utils' +import { levelList, SORT_GF, sortList } from '@tinygrail/_/utils' export const sortDS = [SORT_GF] as const @@ -62,7 +62,7 @@ export default class ScreenTinygrailAdvanceAuction extends store { } @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get advanceAuctionList() { @@ -95,9 +95,7 @@ export default class ScreenTinygrailAdvanceAuction extends store { @computed get levelMap() { const { list } = this.advanceAuctionList const data = {} - list.forEach(item => - data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1) - ) + list.forEach(item => (data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1))) return data } diff --git a/src/screens/tinygrail/advance-auction2/store.ts b/src/screens/tinygrail/advance-auction2/store.ts index 6f7bd1b44..989c1648e 100755 --- a/src/screens/tinygrail/advance-auction2/store.ts +++ b/src/screens/tinygrail/advance-auction2/store.ts @@ -2,14 +2,14 @@ * @Author: czy0729 * @Date: 2020-01-09 19:43:29 * @Last Modified by: czy0729 - * @Last Modified time: 2022-11-08 06:01:40 + * @Last Modified time: 2024-09-09 20:27:12 */ -import { observable, computed } from 'mobx' -import { tinygrailStore, userStore } from '@stores' +import { computed, observable } from 'mobx' +import { systemStore, tinygrailStore, userStore } from '@stores' import { getTimestamp, info } from '@utils' import store from '@utils/store' import { DEV } from '@constants' -import { levelList, sortList, SORT_GF } from '@tinygrail/_/utils' +import { levelList, SORT_GF, sortList } from '@tinygrail/_/utils' export const sortDS = [SORT_GF] as const @@ -64,7 +64,7 @@ export default class ScreenTinygrailAdvanceAuction2 extends store { } @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get advanceAuctionList() { @@ -97,9 +97,7 @@ export default class ScreenTinygrailAdvanceAuction2 extends store { @computed get levelMap() { const { list } = this.advanceAuctionList const data = {} - list.forEach(item => - data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1) - ) + list.forEach(item => (data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1))) return data } diff --git a/src/screens/tinygrail/advance-bid/store.ts b/src/screens/tinygrail/advance-bid/store.ts index dd9f4c8b8..9272af3d0 100755 --- a/src/screens/tinygrail/advance-bid/store.ts +++ b/src/screens/tinygrail/advance-bid/store.ts @@ -2,10 +2,10 @@ * @Author: czy0729 * @Date: 2020-01-08 11:42:58 * @Last Modified by: czy0729 - * @Last Modified time: 2022-11-08 06:07:27 + * @Last Modified time: 2024-09-09 20:26:29 */ -import { observable, computed } from 'mobx' -import { tinygrailStore, userStore } from '@stores' +import { computed, observable } from 'mobx' +import { systemStore, tinygrailStore, userStore } from '@stores' import { getTimestamp, info } from '@utils' import store from '@utils/store' import { DEV } from '@constants' @@ -50,7 +50,7 @@ export default class ScreenTinygrailAdvanceBid extends store { } @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get advanceBidList() { @@ -76,9 +76,7 @@ export default class ScreenTinygrailAdvanceBid extends store { @computed get levelMap() { const { list } = this.advanceBidList const data = {} - list.forEach(item => - data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1) - ) + list.forEach(item => (data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1))) return data } diff --git a/src/screens/tinygrail/advance-sacrifice/store.ts b/src/screens/tinygrail/advance-sacrifice/store.ts index 303514d03..49d737ec8 100755 --- a/src/screens/tinygrail/advance-sacrifice/store.ts +++ b/src/screens/tinygrail/advance-sacrifice/store.ts @@ -2,10 +2,10 @@ * @Author: czy0729 * @Date: 2020-01-25 20:20:06 * @Last Modified by: czy0729 - * @Last Modified time: 2022-11-08 06:11:58 + * @Last Modified time: 2024-09-09 20:26:09 */ import { computed } from 'mobx' -import { tinygrailStore, userStore } from '@stores' +import { systemStore, tinygrailStore, userStore } from '@stores' import { getTimestamp, info } from '@utils' import store from '@utils/store' import { DEV } from '@constants' @@ -40,7 +40,7 @@ export default class ScreenTinygrailAdvanceAuction extends store { // -------------------- get -------------------- @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get advanceSacrificeList() { diff --git a/src/screens/tinygrail/advance-state/store.ts b/src/screens/tinygrail/advance-state/store.ts index ff9c5f9e3..d059f766a 100755 --- a/src/screens/tinygrail/advance-state/store.ts +++ b/src/screens/tinygrail/advance-state/store.ts @@ -2,10 +2,10 @@ * @Author: czy0729 * @Date: 2021-03-14 18:00:02 * @Last Modified by: czy0729 - * @Last Modified time: 2022-11-08 06:23:46 + * @Last Modified time: 2024-09-09 20:25:38 */ -import { observable, computed } from 'mobx' -import { tinygrailStore, userStore } from '@stores' +import { computed, observable } from 'mobx' +import { systemStore, tinygrailStore, userStore } from '@stores' import { getTimestamp, info } from '@utils' import store from '@utils/store' import { DEV } from '@constants' @@ -50,7 +50,7 @@ export default class ScreenTinygrailAdvanceState extends store { } @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get advanceState() { @@ -76,9 +76,7 @@ export default class ScreenTinygrailAdvanceState extends store { @computed get levelMap() { const { list } = this.advanceState const data = {} - list.forEach(item => - data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1) - ) + list.forEach(item => (data[item.level] ? (data[item.level] += 1) : (data[item.level] = 1))) return data } diff --git a/src/screens/tinygrail/index/component/auth/index.tsx b/src/screens/tinygrail/index/component/auth/index.tsx index 187fbe9ff..2ef367e0e 100755 --- a/src/screens/tinygrail/index/component/auth/index.tsx +++ b/src/screens/tinygrail/index/component/auth/index.tsx @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-09-04 21:58:42 * @Last Modified by: czy0729 - * @Last Modified time: 2024-03-11 10:39:30 + * @Last Modified time: 2024-09-09 20:35:13 */ import React from 'react' import { Avatar, Flex, Text, Touchable } from '@components' @@ -15,7 +15,7 @@ import Btns from '../btns' import { COMPONENT } from './ds' import { memoStyles } from './styles' -function Auth(props, { $, navigation }: Ctx) { +function Auth(_props, { $, navigation }: Ctx) { const styles = memoStyles() const { nickname, avatar } = $.userInfo return ( diff --git a/src/screens/tinygrail/index/store.ts b/src/screens/tinygrail/index/store.ts index 8be4eb9c7..857bd11ca 100755 --- a/src/screens/tinygrail/index/store.ts +++ b/src/screens/tinygrail/index/store.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-03-22 08:49:20 * @Last Modified by: czy0729 - * @Last Modified time: 2024-03-16 17:55:41 + * @Last Modified time: 2024-09-09 20:16:11 */ import { computed, observable } from 'mobx' import cheerio from 'cheerio-without-node-native' @@ -44,21 +44,15 @@ export default class ScreenTinygrail extends store { errorCount = 0 init = async () => { - tinygrailStore.fetchAdvance() - - // 初始化state - const state = (await this.getStorage(NAMESPACE)) || {} this.setState({ - ...state, + ...(await this.getStorage(NAMESPACE)), ...EXCLUDE_STATE, _loaded: tinygrailStore.cookie ? getTimestamp() : false }) // 没有资产就自动授权 const { _loaded } = await tinygrailStore.fetchAssets() - if (!_loaded && !DEV) { - await this.doAuth() - } + if (!_loaded && !DEV) await this.doAuth() // 获取资产和用户唯一标识 await queue([ @@ -67,15 +61,11 @@ export default class ScreenTinygrail extends store { () => this.fetchCharaAssets() ]) - tinygrailStore.fetchAdvance() + systemStore.fetchAdvance() this.caculateChange() this.fetchCount() this.checkCount() - // runAfter(() => { - // initXsbRelationOTA() - // }) - return true } @@ -131,7 +121,7 @@ export default class ScreenTinygrail extends store { } @computed get advance() { - return tinygrailStore.advance + return systemStore.advance } @computed get userInfo() { @@ -256,7 +246,7 @@ export default class ScreenTinygrail extends store { /** 刮刮乐 */ doLottery = async ( - navigation: Navigation, + _navigation: Navigation, /** 是否幻想乡 */ isBonus2: boolean = false diff --git a/src/screens/user/dev/base/index.tsx b/src/screens/user/dev/components/base/index.tsx similarity index 63% rename from src/screens/user/dev/base/index.tsx rename to src/screens/user/dev/components/base/index.tsx index 15deb1201..7d39350d3 100644 --- a/src/screens/user/dev/base/index.tsx +++ b/src/screens/user/dev/components/base/index.tsx @@ -2,16 +2,17 @@ * @Author: czy0729 * @Date: 2022-03-01 11:45:48 * @Last Modified by: czy0729 - * @Last Modified time: 2022-08-31 19:06:05 + * @Last Modified time: 2024-09-09 21:16:42 */ import React from 'react' -import { Text, Switch, Touchable } from '@components' -import { ItemSetting } from '@_' +import { Switch, Text, Touchable } from '@components' +import { IconTouchable, ItemSetting } from '@_' import { systemStore, userStore } from '@stores' import { useObserver } from '@utils/hooks' +import { NavigationProps } from '@types' import { memoStyles } from './styles' -function Base() { +function Base({ navigation }: NavigationProps) { return useObserver(() => { const styles = memoStyles() const { dev, devEvent } = systemStore.state @@ -19,13 +20,7 @@ function Base() { <> - } + ft={} withoutFeedback /> {userStore.isDeveloper && ( @@ -41,6 +36,20 @@ function Base() { withoutFeedback /> )} + {userStore.isDeveloper && ( + { + navigation.push('Playground') + }} + /> + } + withoutFeedback + /> + )} orientation.unlockAsync()}> + { + orientation.unlockAsync() + }} + > 解锁旋转 } diff --git a/src/screens/user/dev/update-advance/index.tsx b/src/screens/user/dev/components/update-advance/index.tsx similarity index 75% rename from src/screens/user/dev/update-advance/index.tsx rename to src/screens/user/dev/components/update-advance/index.tsx index 7e4792ece..1594b70ae 100644 --- a/src/screens/user/dev/update-advance/index.tsx +++ b/src/screens/user/dev/components/update-advance/index.tsx @@ -2,17 +2,17 @@ * @Author: czy0729 * @Date: 2022-03-01 10:16:51 * @Last Modified by: czy0729 - * @Last Modified time: 2022-08-19 03:17:10 + * @Last Modified time: 2024-09-09 19:20:45 */ -import React, { useState, useCallback } from 'react' +import React, { useCallback, useState } from 'react' import { View } from 'react-native' -import { Touchable, Flex, Text, Input, Iconfont, SegmentedControl } from '@components' +import { Flex, Iconfont, Input, SegmentedControl, Text, Touchable } from '@components' import { ItemSetting } from '@_' import { _ } from '@stores' import { info } from '@utils' -import { useObserver, useMount } from '@utils/hooks' +import { useMount, useObserver } from '@utils/hooks' +import { get, update } from '@utils/kv' import { NavigationProps } from '@types' -import { read, put } from '../db' import { memoStyles } from './styles' function UpdateAdvance({ navigation }: NavigationProps) { @@ -23,42 +23,30 @@ function UpdateAdvance({ navigation }: NavigationProps) { const [data, setData] = useState({}) const fetchData = useCallback(async () => { - const { content } = await read({ - path: 'advance.json' - }) - setData(JSON.parse(content)) + const data = await get('advance') + setData(data) }, []) const onUidChange = useCallback( evt => { - const { nativeEvent } = evt - const { text } = nativeEvent - setUid(text) + setUid(evt.nativeEvent.text) }, [setUid] ) const onValChange = useCallback( evt => { - const { nativeEvent } = evt - const { text } = nativeEvent - setVal(text) + setVal(evt.nativeEvent.text) }, [setVal] ) const onSubmit = useCallback(async () => { // 确保每次保存前都获取到最新的数据 - const { content } = await read({ - path: 'advance.json' - }) - const data = JSON.parse(content) + const data = await get('advance') data[uid] = `${payType}|${val}` - await put({ - path: 'advance.json', - content: JSON.stringify(data, null, 2) - }) + await update('advance', data) info('update db success') fetchData() @@ -85,12 +73,7 @@ function UpdateAdvance({ navigation }: NavigationProps) { - + - + - open(`${GITHUB_HOST}/commits/master/tourist.json`)} - > - - )} diff --git a/src/screens/user/dev/update-tourist/styles.ts b/src/screens/user/dev/components/update-tourist/styles.ts similarity index 100% rename from src/screens/user/dev/update-tourist/styles.ts rename to src/screens/user/dev/components/update-tourist/styles.ts diff --git a/src/screens/user/dev/update-tourist/utils.ts b/src/screens/user/dev/components/update-tourist/utils.ts similarity index 100% rename from src/screens/user/dev/update-tourist/utils.ts rename to src/screens/user/dev/components/update-tourist/utils.ts diff --git a/src/screens/user/dev/users-advance/index.tsx b/src/screens/user/dev/components/users-advance/index.tsx similarity index 75% rename from src/screens/user/dev/users-advance/index.tsx rename to src/screens/user/dev/components/users-advance/index.tsx index 21a123ba9..5049df36e 100644 --- a/src/screens/user/dev/users-advance/index.tsx +++ b/src/screens/user/dev/components/users-advance/index.tsx @@ -4,15 +4,15 @@ * @Last Modified by: czy0729 * @Last Modified time: 2022-09-07 04:20:03 */ -import React, { useState, useCallback } from 'react' +import React, { useCallback, useState } from 'react' import { ScrollView, Text, Touchable } from '@components' -import { ItemSetting, ItemFriends } from '@_' +import { ItemFriends, ItemSetting } from '@_' import { usersStore } from '@stores' import { info } from '@utils' -import { useObserver } from '@utils/hooks' import { queue } from '@utils/fetch' +import { useObserver } from '@utils/hooks' import { NavigationProps } from '@types' -import { read } from '../db' +import { read } from '../../db' import { sortByRecent } from './utils' import { memoStyles } from './styles' @@ -29,9 +29,7 @@ function UsersAdvance({ navigation }: NavigationProps) { const data = JSON.parse(content) const uids = Object.keys(data) setList( - uids.sort((a, b) => - sortByRecent(usersStore.users(a).recent, usersStore.users(b).recent) - ) + uids.sort((a, b) => sortByRecent(usersStore.users(a).recent, usersStore.users(b).recent)) ) await queue( @@ -45,9 +43,7 @@ function UsersAdvance({ navigation }: NavigationProps) { info('update users done') setList( - uids.sort((a, b) => - sortByRecent(usersStore.users(a).recent, usersStore.users(b).recent) - ) + uids.sort((a, b) => sortByRecent(usersStore.users(a).recent, usersStore.users(b).recent)) ) }, []) @@ -67,11 +63,7 @@ function UsersAdvance({ navigation }: NavigationProps) { {show && ( {list.map(item => ( - + ))} )} diff --git a/src/screens/user/dev/users-advance/styles.ts b/src/screens/user/dev/components/users-advance/styles.ts similarity index 100% rename from src/screens/user/dev/users-advance/styles.ts rename to src/screens/user/dev/components/users-advance/styles.ts diff --git a/src/screens/user/dev/users-advance/utils.ts b/src/screens/user/dev/components/users-advance/utils.ts similarity index 100% rename from src/screens/user/dev/users-advance/utils.ts rename to src/screens/user/dev/components/users-advance/utils.ts diff --git a/src/screens/user/dev/index.tsx b/src/screens/user/dev/index.tsx index 6b75b6d1b..02cd56fce 100755 --- a/src/screens/user/dev/index.tsx +++ b/src/screens/user/dev/index.tsx @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2020-01-13 11:23:53 * @Last Modified by: czy0729 - * @Last Modified time: 2024-03-04 17:33:00 + * @Last Modified time: 2024-09-09 21:16:53 */ import React from 'react' import { View } from 'react-native' @@ -10,20 +10,16 @@ import { Component, Header, ScrollView } from '@components' import { _, userStore } from '@stores' import { useObserver } from '@utils/hooks' import { NavigationProps } from '@types' -import Base from './base' -import Detail from './detail' -import ScreenOrientation from './screen-orientation' -import UpdateAdvance from './update-advance' -import UpdateKey from './update-key' -import UpdateTourist from './update-tourist' -import UsersAdvance from './users-advance' +import Base from './components/base' +import Detail from './components/detail' +import ScreenOrientation from './components/screen-orientation' +import UpdateAdvance from './components/update-advance' +import UpdateKey from './components/update-key' +import UpdateTourist from './components/update-tourist' +// import UsersAdvance from './components/users-advance' import { memoStyles } from './styles' const DEV = ({ navigation }: NavigationProps) => { - // useRunAfter(() => { - // initXsbRelationOTA() - // }) - return useObserver(() => { const styles = memoStyles() return ( @@ -35,13 +31,12 @@ const DEV = ({ navigation }: NavigationProps) => { scrollToTop > - + {userStore.isDeveloper && ( <> - )} diff --git a/src/screens/user/setting/component/cdn/cdn-avatar/utils.ts b/src/screens/user/setting/component/cdn/cdn-avatar/utils.ts index f226d055c..d71b8ae20 100644 --- a/src/screens/user/setting/component/cdn/cdn-avatar/utils.ts +++ b/src/screens/user/setting/component/cdn/cdn-avatar/utils.ts @@ -2,12 +2,12 @@ * @Author: czy0729 * @Date: 2024-04-21 16:39:45 * @Last Modified by: czy0729 - * @Last Modified time: 2024-04-21 16:52:39 + * @Last Modified time: 2024-09-09 20:41:08 */ import { systemStore, userStore } from '@stores' import { info } from '@utils' import { ADVANCE_CDN } from '@constants' -import DS from '@assets/json/advance.json' +import advanceJSON from '@assets/json/advance.json' export async function checkAdvance() { if (!systemStore.advance) { @@ -17,7 +17,7 @@ export async function checkAdvance() { const { myId, myUserId } = userStore if (myId || myUserId) { - const value = DS[myId] || DS[myUserId] + const value = advanceJSON[myId] || advanceJSON[myUserId] if (value == 1) { info('你是老打赏用户或特殊关照会员,允许开启') return true diff --git a/src/screens/user/setting/component/cdn/cdn-cover/utils.ts b/src/screens/user/setting/component/cdn/cdn-cover/utils.ts index b68d88811..2f99081a3 100644 --- a/src/screens/user/setting/component/cdn/cdn-cover/utils.ts +++ b/src/screens/user/setting/component/cdn/cdn-cover/utils.ts @@ -2,12 +2,12 @@ * @Author: czy0729 * @Date: 2024-04-21 17:43:39 * @Last Modified by: czy0729 - * @Last Modified time: 2024-04-21 17:49:23 + * @Last Modified time: 2024-09-09 20:40:55 */ import { systemStore, userStore } from '@stores' import { info } from '@utils' import { ADVANCE_CDN } from '@constants' -import DS from '@assets/json/advance.json' +import advanceJSON from '@assets/json/advance.json' export function waitToResetCDN() { setTimeout(() => { @@ -19,7 +19,7 @@ export function waitToResetCDN() { export async function checkAdvance() { const { myId, myUserId } = userStore if (myId || myUserId) { - const value = DS[myId] || DS[myUserId] + const value = advanceJSON[myId] || advanceJSON[myUserId] if (value == 1) { info('你是老打赏用户或特殊关照会员,允许开启') return true diff --git a/src/screens/user/sponsor/ds.ts b/src/screens/user/sponsor/ds.ts index 441e3d29b..a23d4b10a 100644 --- a/src/screens/user/sponsor/ds.ts +++ b/src/screens/user/sponsor/ds.ts @@ -2,10 +2,10 @@ * @Author: czy0729 * @Date: 2022-09-07 14:38:45 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-15 16:09:05 + * @Last Modified time: 2024-09-09 20:39:22 */ import { desc } from '@utils' -import DS from '@assets/json/advance.json' +import advanceJSON from '@assets/json/advance.json' import USERS_MAP from '@assets/json/user.json' import { Loaded } from '@types' @@ -20,9 +20,9 @@ export const STATE = { _loaded: false as Loaded } -export const LIST = Object.keys(DS) +export const LIST = Object.keys(advanceJSON) .map(key => { - const item = DS[key] + const item = advanceJSON[key] if (item == 1) { return { data: key, diff --git a/src/screens/user/sponsor/store.ts b/src/screens/user/sponsor/store.ts index cfcaac4ec..9de0ab678 100644 --- a/src/screens/user/sponsor/store.ts +++ b/src/screens/user/sponsor/store.ts @@ -2,12 +2,12 @@ * @Author: czy0729 * @Date: 2023-01-07 16:44:54 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-15 15:52:20 + * @Last Modified time: 2024-09-09 20:39:06 */ import { computed, observable } from 'mobx' import { info } from '@utils' import store from '@utils/store' -import DS from '@assets/json/advance.json' +import advanceJSON from '@assets/json/advance.json' import { NAMESPACE, STATE } from './ds' export default class ScreeSponsor extends store { @@ -24,7 +24,7 @@ export default class ScreeSponsor extends store { // -------------------- get -------------------- @computed get list() { - return Object.keys(DS) + return Object.keys(advanceJSON) } // -------------------- page -------------------- diff --git a/src/screens/user/sponsor/utils.ts b/src/screens/user/sponsor/utils.ts index 089129150..65aab3f08 100644 --- a/src/screens/user/sponsor/utils.ts +++ b/src/screens/user/sponsor/utils.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2022-09-07 00:56:03 * @Last Modified by: czy0729 - * @Last Modified time: 2024-07-15 16:09:41 + * @Last Modified time: 2024-09-09 20:38:43 */ import { useCallback, useState } from 'react' import dayjs from 'dayjs' @@ -11,7 +11,7 @@ import { queue, toFixed } from '@utils' import { update } from '@utils/kv' import treemap from '@utils/thirdParty/treemap' import { IOS } from '@constants' -import DS from '@assets/json/advance.json' +import advanceJSON from '@assets/json/advance.json' import { AnyObject } from '@types' import { FILTER_RATE, LIST } from './ds' @@ -131,7 +131,7 @@ export async function devGetUsersInfo() { console.info('devGetUsersInfo') const USERS_MAP = {} - const items = Object.keys(DS) + const items = Object.keys(advanceJSON) await queue( items.map((userId, index) => async () => { const data = await usersStore.fetchUsers({ @@ -160,7 +160,7 @@ export async function devLocalUsersInfo() { await usersStore.init('users') const USERS_MAP = {} - Object.keys(DS).forEach(userId => { + Object.keys(advanceJSON).forEach(userId => { const data = usersStore.users(userId) USERS_MAP[userId] = { n: data.userName diff --git a/src/screens/user/user-setting/ds.ts b/src/screens/user/user-setting/ds.ts index 68db22b45..b18a55994 100644 --- a/src/screens/user/user-setting/ds.ts +++ b/src/screens/user/user-setting/ds.ts @@ -4,12 +4,8 @@ * @Last Modified by: czy0729 * @Last Modified time: 2024-09-08 14:01:43 */ -import { GITHUB_HOST } from '@constants' - export const COMPONENT = 'UserSetting' -export const ONLINE_BGS_URL = `${GITHUB_HOST}/raw/master/bg.json` - export const REG_BG = /\[bg\](.+?)\[\/bg\]/ export const REG_AVATAR = /\[avatar\](.+?)\[\/avatar\]/ diff --git a/src/screens/user/user-setting/store/fetch.ts b/src/screens/user/user-setting/store/fetch.ts index 475332b0e..e4e99d33b 100644 --- a/src/screens/user/user-setting/store/fetch.ts +++ b/src/screens/user/user-setting/store/fetch.ts @@ -2,12 +2,11 @@ * @Author: czy0729 * @Date: 2024-09-08 13:38:24 * @Last Modified by: czy0729 - * @Last Modified time: 2024-09-08 13:43:18 + * @Last Modified time: 2024-09-09 21:22:39 */ import { userStore } from '@stores' -import { getTimestamp } from '@utils' +import { get } from '@utils/kv' import { randomAvatars } from '@utils/user-setting' -import { ONLINE_BGS_URL } from '../ds' import Computed from './computed' export default class Fetch extends Computed { @@ -26,8 +25,7 @@ export default class Fetch extends Computed { /** 预设背景 */ fetchBgs = async () => { - const bgs = - (await fetch(`${ONLINE_BGS_URL}?t=${getTimestamp()}`).then(response => response.json())) || [] + const { data: bgs } = await get('bgs') this.setState({ bgs }) diff --git a/src/stores/tinygrail/computed.ts b/src/stores/tinygrail/computed.ts index e7cca67fb..549ce33a2 100644 --- a/src/stores/tinygrail/computed.ts +++ b/src/stores/tinygrail/computed.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2023-04-26 14:35:57 * @Last Modified by: czy0729 - * @Last Modified time: 2024-05-19 15:19:09 + * @Last Modified time: 2024-09-09 20:10:33 */ import { computed } from 'mobx' import { getTimestamp } from '@utils' @@ -29,12 +29,6 @@ export default class Computed extends State implements StoreConstructor { - if (this.advance) return true - if (!UserStore.myId) return false - try { - const { _response } = await xhrCustom({ - url: `${GITHUB_HOST}/raw/master/advance.json?t=${getTimestamp()}` - }) - const advanceUserMap = JSON.parse(_response) - - if (advanceUserMap[UserStore.myId]) { - const key = 'advance' - this.setState({ - advance: true - }) - this.save(key) - } - } catch (error) { - console.error(NAMESPACE, 'fetchAdvance', error) - } - return true - } - /** * 人物数据 * - 20201017 API_TINYGRAIL_CHARAS => API_TINYGRAIL_CHARA diff --git a/src/stores/tinygrail/index.ts b/src/stores/tinygrail/index.ts index 299eeabfc..8c6d1d8e1 100755 --- a/src/stores/tinygrail/index.ts +++ b/src/stores/tinygrail/index.ts @@ -3,14 +3,13 @@ * @Author: czy0729 * @Date: 2019-08-24 23:18:17 * @Last Modified by: czy0729 - * @Last Modified time: 2023-04-26 14:42:30 + * @Last Modified time: 2024-09-09 20:10:30 */ import Action from './action' const tinygrailStore = new Action() setTimeout(() => { tinygrailStore.init('cookie') - tinygrailStore.init('advance') tinygrailStore.init('hash') }, 2000) diff --git a/src/stores/tinygrail/init.ts b/src/stores/tinygrail/init.ts index ff4b6c88b..aa5cde165 100755 --- a/src/stores/tinygrail/init.ts +++ b/src/stores/tinygrail/init.ts @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-08-24 23:20:12 * @Last Modified by: czy0729 - * @Last Modified time: 2024-05-19 14:37:35 + * @Last Modified time: 2024-09-09 20:10:18 */ import { LIST_EMPTY } from '@constants' import { Loaded } from '@types' @@ -224,9 +224,6 @@ export const STATE = { /** 授权 cookie */ cookie: '', - /** 高级会员 */ - advance: false, - /** 用户唯一标识 */ hash: '', @@ -409,7 +406,6 @@ export const STATE = { } export const LOADED = { - advance: false, advanceAuctionList2: false, advanceAuctionList: false, advanceBidList: false, diff --git a/src/utils/fetch.v0/index.ts b/src/utils/fetch.v0/index.ts index a820b1962..810c70ae9 100644 --- a/src/utils/fetch.v0/index.ts +++ b/src/utils/fetch.v0/index.ts @@ -3,22 +3,14 @@ * @Author: czy0729 * @Date: 2022-01-30 22:14:41 * @Last Modified by: czy0729 - * @Last Modified time: 2023-11-29 02:41:28 + * @Last Modified time: 2024-09-09 20:33:17 */ import dayjs from 'dayjs' -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import { devLog } from '@components' import { getTimestamp } from '@utils' import { Subject as BaseSubject, SubjectId, UserId } from '@types' import { syncSystemStore } from '../async' import { request } from './utils' -import { - API_COLLECTIONS, - API_COLLECTION, - HOST_API_V0, - API_EPS_COLLECTION, - API_ME -} from './ds' +import { API_COLLECTION, API_COLLECTIONS, API_EPS_COLLECTION, API_ME, HOST_API_V0 } from './ds' import { Collection, CollectionItem, UserCollection, UserCollectionItem } from './types' export { HOST_API_V0, request } @@ -123,9 +115,7 @@ async function fetchCollectionAll(userId: UserId) { } /** 获取在看收藏 */ -export async function fetchCollectionV0(args: { - userId: UserId -}): Promise { +export async function fetchCollectionV0(args: { userId: UserId }): Promise { const { userId } = args || {} const data: UserCollection = { list: [], @@ -141,7 +131,7 @@ export async function fetchCollectionV0(args: { // devLog(`fetchv0 | all.length: ${all.length}`) if (all.length) { - all.forEach((item, index) => { + all.forEach((_item, index) => { const cItem = all[index] const subject: BaseSubject = { id: cItem.subject_id,