feat: 完善代理池与抢购链路,发布 0.5.0
This commit is contained in:
@@ -6,6 +6,7 @@ import { useProducts } from '@/composables/useProducts'
|
||||
import type { Product } from '@/composables/useProducts'
|
||||
import { useActivity } from '@/composables/useActivity'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
import { formatExchangeTime, formatShortExchangeTime } from '@/utils/formatTime'
|
||||
import {
|
||||
ExportLatestXiaodianReport,
|
||||
QueryExchangeRecords,
|
||||
@@ -242,23 +243,10 @@ const recordSummary = (accountName: string) => {
|
||||
if (!records.length) return ''
|
||||
const latest = records[0]
|
||||
const name = latest.commodityName || latest.commodityId || '-'
|
||||
const time = formatShortTime(latest.time || latest.buyTime || '')
|
||||
const time = formatShortExchangeTime(latest.time || latest.buyTime || '')
|
||||
return time ? `${name} · ${time}` : name
|
||||
}
|
||||
|
||||
const formatShortTime = (value: string) => {
|
||||
if (!value) return ''
|
||||
const text = String(value)
|
||||
const match = text.match(/(\d{2})[-/](\d{2})\s+(\d{2}:\d{2})/)
|
||||
if (match) return `${match[1]}-${match[2]} ${match[3]}`
|
||||
const numeric = Number(text)
|
||||
if (Number.isFinite(numeric) && numeric > 0) {
|
||||
const date = new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric)
|
||||
return `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`
|
||||
}
|
||||
return text.replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
const getLookupResult = (accountName: string) => exchangeLookup.value?.results[accountName]
|
||||
|
||||
const getMatchedRecord = (accountName: string) => {
|
||||
@@ -304,8 +292,6 @@ const getResultMessage = (name: string) => {
|
||||
return msg.length > 46 ? msg.slice(0, 46) + '...' : msg
|
||||
}
|
||||
|
||||
const formatTime = (value: string) => value ? value.replace('T', ' ') : '-'
|
||||
|
||||
const orderStatus = (status: string) => {
|
||||
const labels: Record<string, { text: string; cls: string }> = {
|
||||
'0': { text: '待支付', cls: 'order-pending' },
|
||||
@@ -619,7 +605,7 @@ const closeExchangeRecords = () => {
|
||||
<div v-if="record.showName" class="account-sub">{{ record.showName }}</div>
|
||||
</td>
|
||||
<td>×{{ record.exchangeNum || 1 }}</td>
|
||||
<td>{{ formatTime(record.time) }}</td>
|
||||
<td>{{ formatExchangeTime(record.time) }}</td>
|
||||
<td>{{ record.score || '-' }}</td>
|
||||
<td>{{ record.nickName || '-' }}</td>
|
||||
</tr>
|
||||
@@ -632,8 +618,8 @@ const closeExchangeRecords = () => {
|
||||
<tbody>
|
||||
<tr v-for="(record, index) in recordsModal.records" :key="`${record.commodityId}-${record.buyTime}-${index}`">
|
||||
<td><div class="record-product">{{ record.commodityName || record.commodityId }}</div><div v-if="record.quantity > 1" class="account-sub">数量 ×{{ record.quantity }}</div></td>
|
||||
<td>{{ formatTime(record.buyTime) }}</td>
|
||||
<td>{{ formatTime(record.payTime) }}</td>
|
||||
<td>{{ formatExchangeTime(record.buyTime) }}</td>
|
||||
<td>{{ formatExchangeTime(record.payTime) }}</td>
|
||||
<td>{{ record.price }}</td>
|
||||
<td><span class="order-status" :class="orderStatus(record.status).cls">{{ orderStatus(record.status).text }}</span></td>
|
||||
<td>{{ record.roleName || '-' }}</td>
|
||||
|
||||
@@ -400,7 +400,7 @@ onUnmounted(() => {
|
||||
<button v-if="isXiaodian" class="btn btn-primary" @click="openBindQRCode">获取绑定二维码</button>
|
||||
<button v-if="isXiaodian" class="btn btn-fixed" @click="startFixedBuy">固定抢购</button>
|
||||
</div>
|
||||
<div class="schedule-item target-item">
|
||||
<div v-if="isXiaodian" class="schedule-item target-item">
|
||||
<label>目标</label>
|
||||
<input v-model="targetTime" type="time" step="1">
|
||||
</div>
|
||||
@@ -469,8 +469,8 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 非和平小店仅显示目标时间,保持原有定时布局。 -->
|
||||
<div v-else class="schedule-bar">
|
||||
<!-- 非和平小店只保留一处目标时间。 -->
|
||||
<div v-if="!isXiaodian" class="schedule-bar">
|
||||
<div class="schedule-item">
|
||||
<label>目标</label>
|
||||
<input
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useProducts } from '@/composables/useProducts'
|
||||
import { useAccounts } from '@/composables/useAccounts'
|
||||
import { useActivity } from '@/composables/useActivity'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
import { formatExchangeTime } from '@/utils/formatTime'
|
||||
import { QueryXiaodianExchangeRecords } from '@wails/go/app/App'
|
||||
|
||||
const { selectedProductId, selectedProductName } = useProducts()
|
||||
@@ -56,15 +57,6 @@ const queryRecords = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const formatTime = (value: string) => {
|
||||
if (!value) return '-'
|
||||
const numeric = Number(value)
|
||||
if (Number.isFinite(numeric) && numeric > 0) {
|
||||
return new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric).toLocaleString('zh-CN')
|
||||
}
|
||||
return value.replace('T', ' ')
|
||||
}
|
||||
|
||||
watch(selectedProductId, () => {
|
||||
queryResult.value = null
|
||||
})
|
||||
@@ -133,7 +125,7 @@ watch(selectedProductId, () => {
|
||||
<div v-for="(record, index) in row.records" :key="`${row.name}-${index}`" class="record-detail">
|
||||
<span class="detail-name">{{ record.commodityName || record.commodityId }}</span>
|
||||
<span class="detail-quantity">×{{ record.quantity || 1 }}</span>
|
||||
<span class="detail-time">{{ formatTime(record.buyTime) }}</span>
|
||||
<span class="detail-time">{{ formatExchangeTime(record.buyTime) }}</span>
|
||||
<span class="detail-status">状态 {{ record.status || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useTheme } from '@/composables/useTheme'
|
||||
import { useScheduler } from '@/composables/useScheduler'
|
||||
import { useSettings } from '@/composables/useSettings'
|
||||
import StatusGrid from '@/components/console/StatusGrid.vue'
|
||||
import ControlStrip from '@/components/console/ControlStrip.vue'
|
||||
import AccountTable from '@/components/account/AccountTable.vue'
|
||||
@@ -16,13 +17,44 @@ defineProps<{
|
||||
|
||||
const { theme, toggleTheme } = useTheme()
|
||||
const { runState, countdownSeconds, formatRemain } = useScheduler()
|
||||
const { settings, loadSettings } = useSettings()
|
||||
|
||||
const settingsModalRef = ref<InstanceType<typeof SettingsModal> | null>(null)
|
||||
const currentPage = ref<'console' | 'ck' | 'exchange'>('console')
|
||||
|
||||
const openSettings = () => {
|
||||
settingsModalRef.value?.open()
|
||||
const proxyAutoFetchReady = computed(() => (
|
||||
settings.value.proxyEnabled
|
||||
&& settings.value.autoFetchProxyOnSchedule
|
||||
&& !!settings.value.proxyApi.trim()
|
||||
))
|
||||
|
||||
const proxyNeedsApi = computed(() => (
|
||||
settings.value.proxyEnabled
|
||||
&& settings.value.autoFetchProxyOnSchedule
|
||||
&& !settings.value.proxyApi.trim()
|
||||
))
|
||||
|
||||
const proxySummary = computed(() => {
|
||||
if (!settings.value.proxyEnabled) return '代理未启用'
|
||||
const size = settings.value.accountsPerProxy || 5
|
||||
const spare = settings.value.proxySparePercent || 25
|
||||
if (!settings.value.autoFetchProxyOnSchedule) return `代理 · ${size}号/组 · 备用${spare}%`
|
||||
if (!settings.value.proxyApi.trim()) return `代理 · ${size}号/组 · 缺少 API`
|
||||
return `代理 · ${size}号/组 · 备用${spare}% · 预取`
|
||||
})
|
||||
|
||||
const proxyTitle = computed(() => {
|
||||
if (!settings.value.proxyEnabled) return '代理尚未启用,点击配置'
|
||||
if (proxyNeedsApi.value) return '已开启定时预取,但缺少代理提取 API;点击配置'
|
||||
if (proxyAutoFetchReady.value) return '定时抢购触发前 30 秒自动提取并校验代理;点击查看设置'
|
||||
return '代理已启用,点击打开代理设置'
|
||||
})
|
||||
|
||||
const openSettings = (section = '') => {
|
||||
settingsModalRef.value?.open(section)
|
||||
}
|
||||
|
||||
onMounted(loadSettings)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -38,7 +70,22 @@ const openSettings = () => {
|
||||
<span v-if="countdownSeconds > 0 && currentPage === 'console'" class="countdown-badge">{{ formatRemain(countdownSeconds) }}</span>
|
||||
</div>
|
||||
<div class="top-actions">
|
||||
<button class="btn btn-ghost icon-btn" title="设置" aria-label="设置" @click="openSettings">⚙</button>
|
||||
<button
|
||||
class="proxy-quick"
|
||||
:class="{
|
||||
active: settings.proxyEnabled,
|
||||
scheduled: proxyAutoFetchReady,
|
||||
warning: proxyNeedsApi
|
||||
}"
|
||||
:title="proxyTitle"
|
||||
@click="openSettings('proxy')"
|
||||
>
|
||||
{{ proxySummary }}
|
||||
</button>
|
||||
<button class="btn btn-ghost settings-button" title="设置" aria-label="设置" @click="openSettings()">
|
||||
<span aria-hidden="true">⚙</span>
|
||||
<span>设置</span>
|
||||
</button>
|
||||
<button class="btn btn-ghost icon-btn theme-toggle" :title="theme === 'light' ? '切换到暗色' : '切换到亮色'" :aria-label="theme === 'light' ? '切换到暗色' : '切换到亮色'" @click="toggleTheme">{{ theme === 'light' ? '☀' : '☾' }}</button>
|
||||
</div>
|
||||
</header>
|
||||
@@ -88,6 +135,50 @@ const openSettings = () => {
|
||||
.top-actions { gap: 6px; }
|
||||
.nav-tabs { gap: 4px; }
|
||||
|
||||
.proxy-quick {
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
background: var(--surface-2);
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.proxy-quick:hover {
|
||||
border-color: var(--accent-border);
|
||||
color: var(--text-strong);
|
||||
}
|
||||
|
||||
.proxy-quick.active {
|
||||
color: var(--success);
|
||||
border-color: var(--success);
|
||||
background: var(--success-soft);
|
||||
}
|
||||
|
||||
.proxy-quick.scheduled {
|
||||
color: var(--accent);
|
||||
border-color: var(--accent-border);
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.proxy-quick.warning {
|
||||
color: var(--warning);
|
||||
border-color: var(--warning);
|
||||
background: var(--warning-soft);
|
||||
}
|
||||
|
||||
.settings-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.nav-tab {
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
@@ -129,4 +220,10 @@ const openSettings = () => {
|
||||
.right { overflow: visible; min-height: auto; }
|
||||
.console-workspace { min-height: 520px; padding: 14px; }
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.console-head { flex-wrap: wrap; }
|
||||
.top-actions { width: 100%; justify-content: flex-end; }
|
||||
.proxy-quick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { computed, nextTick, ref } from 'vue'
|
||||
import { useSettings, type RetryStage } from '@/composables/useSettings'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
import { TestProxy, FetchProxy } from '@wails/go/app/App'
|
||||
@@ -8,6 +8,7 @@ const { settings, loadSettings, saveSettings } = useSettings()
|
||||
const { showToast } = useToast()
|
||||
|
||||
const visible = ref(false)
|
||||
const proxySectionRef = ref<HTMLElement | null>(null)
|
||||
const formData = ref({
|
||||
timeApiUrl: '',
|
||||
activity: '',
|
||||
@@ -22,8 +23,10 @@ const formData = ref({
|
||||
proxyEnabled: false,
|
||||
proxyUrl: '',
|
||||
proxyApi: '',
|
||||
proxyExpiresAt: 0,
|
||||
autoFetchProxyOnSchedule: false,
|
||||
accountsPerProxy: 5,
|
||||
proxySparePercent: 25,
|
||||
proxyAutoWhitelist: false,
|
||||
proxyWhitelistReplace: true,
|
||||
proxyWhitelistPassword: '',
|
||||
@@ -34,6 +37,31 @@ const testingProxy = ref(false)
|
||||
const testProxyResult = ref<{ success?: boolean; text?: string; error?: string } | null>(null)
|
||||
const fetchingProxy = ref(false)
|
||||
|
||||
const proxyOverviewTitle = computed(() => (
|
||||
formData.value.proxyEnabled ? '代理已启用' : '代理未启用'
|
||||
))
|
||||
|
||||
const proxyOverviewDetail = computed(() => {
|
||||
if (!formData.value.proxyEnabled) return '启用后可配置账号分组、提取 API 和自动预取'
|
||||
const size = formData.value.accountsPerProxy || 5
|
||||
const spare = formData.value.proxySparePercent || 25
|
||||
if (!formData.value.autoFetchProxyOnSchedule) return `当前每 ${size} 个账号一个代理,备用 ${spare}%`
|
||||
if (!formData.value.proxyApi.trim()) return '已开启自动预取,但尚未填写代理提取 API'
|
||||
return `每 ${size} 个账号一组,备用 ${spare}%;定时抢购触发前 30 秒自动预取`
|
||||
})
|
||||
|
||||
const proxyAutoFetchReady = computed(() => (
|
||||
formData.value.proxyEnabled
|
||||
&& formData.value.autoFetchProxyOnSchedule
|
||||
&& !!formData.value.proxyApi.trim()
|
||||
))
|
||||
|
||||
const proxyAutoFetchMissingAPI = computed(() => (
|
||||
formData.value.proxyEnabled
|
||||
&& formData.value.autoFetchProxyOnSchedule
|
||||
&& !formData.value.proxyApi.trim()
|
||||
))
|
||||
|
||||
const handleTestProxy = async () => {
|
||||
const target = formData.value.proxyUrl.trim()
|
||||
if (!target) {
|
||||
@@ -77,6 +105,7 @@ const handleFetchProxy = async () => {
|
||||
const res = await FetchProxy(api)
|
||||
if (res.success && res.proxyUrl) {
|
||||
formData.value.proxyUrl = res.proxyUrl
|
||||
formData.value.proxyExpiresAt = res.expiresAt || 0
|
||||
formData.value.proxyEnabled = true
|
||||
const expires = res.expiresAt
|
||||
? new Date(res.expiresAt).toLocaleString()
|
||||
@@ -98,7 +127,7 @@ const handleFetchProxy = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const open = async () => {
|
||||
const open = async (section = '') => {
|
||||
await loadSettings()
|
||||
formData.value = {
|
||||
...settings.value,
|
||||
@@ -106,6 +135,10 @@ const open = async () => {
|
||||
}
|
||||
testProxyResult.value = null
|
||||
visible.value = true
|
||||
if (section === 'proxy') {
|
||||
await nextTick()
|
||||
proxySectionRef.value?.scrollIntoView({ block: 'start', behavior: 'smooth' })
|
||||
}
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
@@ -146,21 +179,32 @@ defineExpose({ open, close })
|
||||
<button class="modal-close" @click="close">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- 时间 API -->
|
||||
<div class="form-group">
|
||||
<label class="form-label">时间 API 地址</label>
|
||||
<input
|
||||
v-model="formData.timeApiUrl"
|
||||
class="form-input"
|
||||
type="text"
|
||||
placeholder="留空使用默认地址"
|
||||
>
|
||||
<div class="form-hint">用于获取斗鱼服务端时间,一般不需要修改</div>
|
||||
</div>
|
||||
|
||||
<!-- 实例独立代理设置 (防多开 IP 限流/风控) -->
|
||||
<div class="form-section">
|
||||
<div class="form-section-title">🌐 实例独立代理设置 (防多开 IP 限流)</div>
|
||||
<div ref="proxySectionRef" class="form-section proxy-section">
|
||||
<div class="form-section-title">🌐 代理设置(品赞 / 通用)</div>
|
||||
|
||||
<div
|
||||
class="proxy-overview"
|
||||
:class="{
|
||||
enabled: formData.proxyEnabled,
|
||||
active: proxyAutoFetchReady,
|
||||
warning: proxyAutoFetchMissingAPI
|
||||
}"
|
||||
>
|
||||
<div class="proxy-overview-main">
|
||||
<span class="proxy-status-dot"></span>
|
||||
<strong>{{ proxyOverviewTitle }}</strong>
|
||||
<span>{{ proxyOverviewDetail }}</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="!formData.proxyEnabled"
|
||||
type="button"
|
||||
class="btn btn-ghost btn-sm"
|
||||
@click="formData.proxyEnabled = true"
|
||||
>
|
||||
立即启用
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="toggle-row">
|
||||
@@ -176,18 +220,34 @@ defineExpose({ open, close })
|
||||
</div>
|
||||
|
||||
<div v-if="formData.proxyEnabled" class="proxy-config-area">
|
||||
<div class="form-group">
|
||||
<label class="form-label">每个代理账号数</label>
|
||||
<input
|
||||
v-model.number="formData.accountsPerProxy"
|
||||
class="form-input"
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
step="1"
|
||||
>
|
||||
<div class="form-hint">
|
||||
例如填 5:30 个账号会稳定分成 6 组,每组使用独立代理连接池;定时抢购会按组分别提取并校验代理。
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">每个代理账号数</label>
|
||||
<input
|
||||
v-model.number="formData.accountsPerProxy"
|
||||
class="form-input"
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
step="1"
|
||||
>
|
||||
<div class="form-hint">
|
||||
30 个账号填 5 会分成 6 个活动代理组,每组使用独立连接池。
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">备用代理比例 (%)</label>
|
||||
<input
|
||||
v-model.number="formData.proxySparePercent"
|
||||
class="form-input"
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
step="1"
|
||||
>
|
||||
<div class="form-hint">
|
||||
默认 25%,至少备用 1 个;6 个活动组会额外提取 2 个备用代理。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -200,6 +260,7 @@ defineExpose({ open, close })
|
||||
class="form-input"
|
||||
type="text"
|
||||
placeholder="例: http://115.230.134.174:40014 或 socks5://127.0.0.1:1080"
|
||||
@input="formData.proxyExpiresAt = 0"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
@@ -248,10 +309,10 @@ defineExpose({ open, close })
|
||||
<div class="form-group">
|
||||
<label class="checkbox-row">
|
||||
<input v-model="formData.autoFetchProxyOnSchedule" type="checkbox">
|
||||
<span class="checkbox-text">定时任务触发前 30 秒自动提取并校验分组 IP</span>
|
||||
<span class="checkbox-text">定时抢购触发前 30 秒自动预取并校验代理</span>
|
||||
</label>
|
||||
<div class="form-hint">
|
||||
按“每组账号数”提取对应数量的代理,先测斗鱼时间接口再启用;建议使用 10 分钟以上时长,覆盖抢购与最长 180 秒支付。
|
||||
仅对定时抢购生效。按“每组账号数”提取对应数量,先测斗鱼时间接口再启用;立即抢购会在开始前同步准备代理。建议使用 10 分钟以上时长,覆盖抢购与最长 180 秒支付。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -297,6 +358,18 @@ defineExpose({ open, close })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间 API -->
|
||||
<div class="form-group">
|
||||
<label class="form-label">时间 API 地址</label>
|
||||
<input
|
||||
v-model="formData.timeApiUrl"
|
||||
class="form-input"
|
||||
type="text"
|
||||
placeholder="留空使用默认地址"
|
||||
>
|
||||
<div class="form-hint">用于获取斗鱼服务端时间,一般不需要修改</div>
|
||||
</div>
|
||||
|
||||
<!-- 和平小店参数 -->
|
||||
<div class="form-section">
|
||||
<div class="form-section-title">和平小店商品列表</div>
|
||||
@@ -562,6 +635,76 @@ defineExpose({ open, close })
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.proxy-section {
|
||||
scroll-margin-top: 16px;
|
||||
}
|
||||
|
||||
.proxy-overview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 16px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--surface-2);
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.proxy-overview-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.proxy-overview strong {
|
||||
color: var(--text-strong);
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.proxy-status-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 50%;
|
||||
background: var(--muted);
|
||||
}
|
||||
|
||||
.proxy-overview.enabled {
|
||||
color: var(--success);
|
||||
border-color: var(--success);
|
||||
background: var(--success-soft);
|
||||
}
|
||||
|
||||
.proxy-overview.enabled .proxy-status-dot {
|
||||
background: var(--success);
|
||||
}
|
||||
|
||||
.proxy-overview.active {
|
||||
color: var(--accent);
|
||||
border-color: var(--accent-border);
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.proxy-overview.active .proxy-status-dot {
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
.proxy-overview.warning {
|
||||
color: var(--warning);
|
||||
border-color: var(--warning);
|
||||
background: var(--warning-soft);
|
||||
}
|
||||
|
||||
.proxy-overview.warning .proxy-status-dot {
|
||||
background: var(--warning);
|
||||
}
|
||||
|
||||
.form-section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
|
||||
@@ -22,8 +22,10 @@ export interface Settings {
|
||||
proxyEnabled: boolean
|
||||
proxyUrl: string
|
||||
proxyApi: string
|
||||
proxyExpiresAt: number
|
||||
autoFetchProxyOnSchedule: boolean
|
||||
accountsPerProxy: number
|
||||
proxySparePercent: number
|
||||
proxyAutoWhitelist: boolean
|
||||
proxyWhitelistReplace: boolean
|
||||
proxyWhitelistPassword: string
|
||||
@@ -51,8 +53,10 @@ const settings = ref<Settings>({
|
||||
proxyEnabled: false,
|
||||
proxyUrl: '',
|
||||
proxyApi: '',
|
||||
proxyExpiresAt: 0,
|
||||
autoFetchProxyOnSchedule: false,
|
||||
accountsPerProxy: 5,
|
||||
proxySparePercent: 25,
|
||||
proxyAutoWhitelist: false,
|
||||
proxyWhitelistReplace: true,
|
||||
proxyWhitelistPassword: '',
|
||||
@@ -81,8 +85,10 @@ export function useSettings() {
|
||||
proxyEnabled: !!cfg.proxyEnabled,
|
||||
proxyUrl: cfg.proxyUrl || '',
|
||||
proxyApi: cfg.proxyApi || '',
|
||||
proxyExpiresAt: cfg.proxyExpiresAt || 0,
|
||||
autoFetchProxyOnSchedule: !!cfg.autoFetchProxyOnSchedule,
|
||||
accountsPerProxy: cfg.accountsPerProxy || 5,
|
||||
proxySparePercent: cfg.proxySparePercent || 25,
|
||||
proxyAutoWhitelist: !!cfg.proxyAutoWhitelist,
|
||||
proxyWhitelistReplace: !!cfg.proxyWhitelistReplace,
|
||||
proxyWhitelistPassword: cfg.proxyWhitelistPassword || '',
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
const pad = (value: number) => String(value).padStart(2, '0')
|
||||
|
||||
const parseTimeValue = (value: unknown): Date | null => {
|
||||
const text = String(value ?? '').trim()
|
||||
if (!text) return null
|
||||
|
||||
if (/^\d+$/.test(text)) {
|
||||
const numeric = Number(text)
|
||||
if (!Number.isFinite(numeric) || numeric <= 0) return null
|
||||
const milliseconds = numeric < 10_000_000_000 ? numeric * 1000 : numeric
|
||||
const date = new Date(milliseconds)
|
||||
return Number.isNaN(date.getTime()) ? null : date
|
||||
}
|
||||
|
||||
if (/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}/.test(text)) {
|
||||
const date = new Date(text.replace(' ', 'T'))
|
||||
return Number.isNaN(date.getTime()) ? null : date
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export const formatExchangeTime = (value: unknown): string => {
|
||||
const text = String(value ?? '').trim()
|
||||
if (!text) return '-'
|
||||
const date = parseTimeValue(text)
|
||||
if (!date) return text.replace('T', ' ')
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
}
|
||||
|
||||
export const formatShortExchangeTime = (value: unknown): string => {
|
||||
const text = String(value ?? '').trim()
|
||||
if (!text) return ''
|
||||
const date = parseTimeValue(text)
|
||||
if (!date) return text.replace('T', ' ').slice(0, 16)
|
||||
return `${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`
|
||||
}
|
||||
Reference in New Issue
Block a user