feat: add a fixed-interval button for profiles updating (#670)

This commit is contained in:
YsielX 2025-04-14 10:00:30 +08:00 committed by GitHub
parent b15fc6ce3a
commit a2faf0fc8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 1 deletions

View File

@ -114,6 +114,7 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
interval: item.interval || 0, interval: item.interval || 0,
override: item.override || [], override: item.override || [],
useProxy: item.useProxy || false, useProxy: item.useProxy || false,
allowFixedInterval: item.allowFixedInterval || false,
updated: new Date().getTime() updated: new Date().getTime()
} as IProfileItem } as IProfileItem
switch (newItem.type) { switch (newItem.type) {
@ -162,7 +163,9 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
newItem.home = headers['profile-web-page-url'] newItem.home = headers['profile-web-page-url']
} }
if (headers['profile-update-interval']) { if (headers['profile-update-interval']) {
newItem.interval = parseInt(headers['profile-update-interval']) * 60 if (!item.allowFixedInterval) {
newItem.interval = parseInt(headers['profile-update-interval']) * 60
}
} }
if (headers['subscription-userinfo']) { if (headers['subscription-userinfo']) {
newItem.extra = parseSubinfo(headers['subscription-userinfo']) newItem.extra = parseSubinfo(headers['subscription-userinfo'])

View File

@ -108,6 +108,15 @@ const EditInfoModal: React.FC<Props> = (props) => {
}} }}
/> />
</SettingItem> </SettingItem>
<SettingItem title={t('profiles.editInfo.fixedInterval')}>
<Switch
size="sm"
isSelected={values.allowFixedInterval ?? false}
onValueChange={(v) => {
setValues({ ...values, allowFixedInterval: v })
}}
/>
</SettingItem>
</> </>
)} )}
<SettingItem title={t('profiles.editInfo.override.title')}> <SettingItem title={t('profiles.editInfo.override.title')}>

View File

@ -345,6 +345,7 @@
"profiles.editInfo.url": "Subscription URL", "profiles.editInfo.url": "Subscription URL",
"profiles.editInfo.useProxy": "Use Proxy to Update", "profiles.editInfo.useProxy": "Use Proxy to Update",
"profiles.editInfo.interval": "Upd. Interval (min)", "profiles.editInfo.interval": "Upd. Interval (min)",
"profiles.editInfo.fixedInterval": "Fixed Update Interval",
"profiles.editInfo.override.title": "Override", "profiles.editInfo.override.title": "Override",
"profiles.editInfo.override.global": "Global", "profiles.editInfo.override.global": "Global",
"profiles.editInfo.override.noAvailable": "No available overrides", "profiles.editInfo.override.noAvailable": "No available overrides",

View File

@ -350,6 +350,7 @@
"profiles.editInfo.url": "آدرس اشتراک", "profiles.editInfo.url": "آدرس اشتراک",
"profiles.editInfo.useProxy": "استفاده از پراکسی برای به‌روزرسانی", "profiles.editInfo.useProxy": "استفاده از پراکسی برای به‌روزرسانی",
"profiles.editInfo.interval": "فاصله به‌روزرسانی (دقیقه)", "profiles.editInfo.interval": "فاصله به‌روزرسانی (دقیقه)",
"profiles.editInfo.fixedInterval": "فاصله به‌روزرسانی ثابت",
"profiles.editInfo.override.title": "جایگزینی", "profiles.editInfo.override.title": "جایگزینی",
"profiles.editInfo.override.global": "جهانی", "profiles.editInfo.override.global": "جهانی",
"profiles.editInfo.override.noAvailable": "جایگزینی در دسترس نیست", "profiles.editInfo.override.noAvailable": "جایگزینی در دسترس نیست",

View File

@ -350,6 +350,7 @@
"profiles.editInfo.url": "URL подписки", "profiles.editInfo.url": "URL подписки",
"profiles.editInfo.useProxy": "Использовать прокси для обновления", "profiles.editInfo.useProxy": "Использовать прокси для обновления",
"profiles.editInfo.interval": "Интервал обн. (мин)", "profiles.editInfo.interval": "Интервал обн. (мин)",
"profiles.editInfo.fixedInterval": "Фиксированный интервал обновления",
"profiles.editInfo.override.title": "Переопределение", "profiles.editInfo.override.title": "Переопределение",
"profiles.editInfo.override.global": "Глобальный", "profiles.editInfo.override.global": "Глобальный",
"profiles.editInfo.override.noAvailable": "Нет доступных переопределений", "profiles.editInfo.override.noAvailable": "Нет доступных переопределений",

View File

@ -350,6 +350,7 @@
"profiles.editInfo.url": "订阅地址", "profiles.editInfo.url": "订阅地址",
"profiles.editInfo.useProxy": "使用代理更新", "profiles.editInfo.useProxy": "使用代理更新",
"profiles.editInfo.interval": "更新间隔(分钟)", "profiles.editInfo.interval": "更新间隔(分钟)",
"profiles.editInfo.fixedInterval": "固定更新间隔",
"profiles.editInfo.override.title": "覆写", "profiles.editInfo.override.title": "覆写",
"profiles.editInfo.override.global": "全局", "profiles.editInfo.override.global": "全局",
"profiles.editInfo.override.noAvailable": "没有可用的覆写", "profiles.editInfo.override.noAvailable": "没有可用的覆写",

View File

@ -461,6 +461,7 @@ interface IProfileItem {
useProxy?: boolean useProxy?: boolean
extra?: ISubscriptionUserInfo extra?: ISubscriptionUserInfo
substore?: boolean substore?: boolean
allowFixedInterval?: boolean
} }
interface ISubStoreSub { interface ISubStoreSub {