This commit is contained in:
yml2213
2026-07-06 18:08:23 +08:00
commit 4235cce4f5
49 changed files with 9880 additions and 0 deletions
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
html,body{width:100%;height:100%}input::-ms-clear,input::-ms-reveal{display:none}*,*:before,*:after{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:rgba(0,0,0,0)}@-ms-viewport{width:device-width}body{margin:0}[tabindex="-1"]:focus{outline:none}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5em;font-weight:500}p{margin-top:0;margin-bottom:1em}abbr[title],abbr[data-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;border-bottom:0;cursor:help}address{margin-bottom:1em;font-style:normal;line-height:inherit}input[type=text],input[type=password],input[type=number],textarea{-webkit-appearance:none}ol,ul,dl{margin-top:0;margin-bottom:1em}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:500}dd{margin-bottom:.5em;margin-left:0}blockquote{margin:0 0 1em}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}pre,code,kbd,samp{font-size:1em;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace}pre{margin-top:0;margin-bottom:1em;overflow:auto}figure{margin:0 0 1em}img{vertical-align:middle;border-style:none}a,area,button,[role=button],input:not([type=range]),label,select,summary,textarea{touch-action:manipulation}table{border-collapse:collapse}caption{padding-top:.75em;padding-bottom:.3em;text-align:left;caption-side:bottom}input,button,select,optgroup,textarea{margin:0;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}button,html [type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{padding:0;border-style:none}input[type=radio],input[type=checkbox]{box-sizing:border-box;padding:0}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;margin:0;padding:0;border:0}legend{display:block;width:100%;max-width:100%;margin-bottom:.5em;padding:0;color:inherit;font-size:1.5em;line-height:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item}template{display:none}[hidden]{display:none!important}mark{padding:.2em;background-color:#feffe6}*{box-sizing:border-box}html,body,#root{width:100%;height:100%;margin:0}body{color:#1f2937;background:#eef2f7}.app-shell{display:grid;grid-template-columns:380px minmax(0,1fr);gap:12px;height:100vh;padding:12px;overflow:hidden}.side-panel,.main-panel{min-height:0;border:1px solid #d9e1ea;border-radius:8px;background:#fff}.side-panel{display:flex;flex-direction:column;padding:14px;overflow:auto}.main-panel{display:flex;flex-direction:column;padding:14px;overflow:hidden}.brand-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:14px}.brand-row h4{margin:0 0 2px}.config-form .ant-form-item{margin-bottom:10px}.full{width:100%}.cookie-box textarea,.cookie-box{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.action-bar{display:flex;margin-top:2px}.run-row{width:100%}.run-row .ant-btn-primary{flex:1}.account-list{display:flex;flex-wrap:wrap;gap:6px;min-height:30px;padding-top:12px}.stats-row{margin-bottom:12px}.stats-row .ant-statistic{padding:10px 12px;border:1px solid #e5ebf2;border-radius:6px;background:#f8fafc}.main-panel .ant-tabs{min-height:0;flex:1}.main-panel .ant-tabs-content,.main-panel .ant-tabs-tabpane{height:100%}.log-view{height:calc(100vh - 170px);min-height:360px;overflow:auto;border:1px solid #e5ebf2;border-radius:6px;background:#0f172a;padding:10px}.log-line{display:grid;grid-template-columns:92px 64px minmax(0,1fr);align-items:start;gap:8px;min-height:24px;color:#cbd5e1;font-size:12px;line-height:1.6}.log-line code{white-space:pre-wrap;word-break:break-word;color:inherit}.log-line.level-error{color:#fecaca}.log-line.level-debug{color:#93c5fd}.ant-table-wrapper{height:100%}@media(max-width:980px){.app-shell{grid-template-columns:1fr;overflow:auto}.side-panel,.main-panel{overflow:visible}.log-view{height:420px}}
+13
View File
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>虎牙抢购助手</title>
<script type="module" crossorigin src="/assets/index-qimuTmHR.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-traqBmYm.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>虎牙抢购助手</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+2918
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
{
"name": "huya-go-frontend",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite --host 127.0.0.1",
"build": "vite build",
"preview": "vite preview --host 127.0.0.1",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"antd": "^5.26.2",
"lucide-react": "^0.468.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"typescript": "^5.7.2",
"vite": "^6.0.7"
}
}
+1
View File
@@ -0,0 +1 @@
e6920aa1045c11b65fd4f5e87bc99fe6
+702
View File
@@ -0,0 +1,702 @@
import { useEffect, useMemo, useState } from 'react'
import type { ReactNode } from 'react'
import {
App as AntApp,
Button,
Col,
Divider,
Form,
Input,
InputNumber,
Row,
Select,
Space,
Statistic,
Switch,
Table,
Tabs,
Tag,
Tooltip,
Typography,
} from 'antd'
import type { ColumnsType } from 'antd/es/table'
import {
ClipboardList,
ListChecks,
Play,
RefreshCw,
Search,
ShoppingCart,
Square,
Users,
} from 'lucide-react'
import {
DefaultConfig,
Exchange,
GetLogs,
GetRecords,
IsRunning,
ListPrizes,
PreviewAccounts,
QueryScores,
StartMonitor,
StopMonitor,
} from '../wailsjs/go/gui/App'
import { EventsOn } from '../wailsjs/runtime/runtime'
const storageKey = 'huya-go.gui.config'
type UiConfig = {
transport: string
wssHost: string
sid: number
pid: number
name: string
cookieText: string
loops: number
delayMs: number
concurrency: number
stopAfterSuccess: boolean
timeoutSec: number
startAt: string
}
type AccountPreview = {
line: number
uid: number
valid: boolean
error?: string
}
type LogEntry = {
time: string
level: string
message: string
}
type PrizeInfo = {
id: number
name: string
score?: number
new_score?: number
num?: number
left_num?: number
status?: number
percent?: string
}
type ScoreResult = {
uid: number
score: number
resp?: {
status?: number
msg?: string
}
error?: string
}
type UserPrizeInfo = {
id?: number
name?: string
score?: number
new_score?: number
status?: number
create_time?: number
}
type RecordResult = {
uid: number
records?: UserPrizeInfo[]
resp?: {
msg?: string
}
error?: string
}
type ExchangeInfo = {
pid?: number
exchange_score?: number
exchangeScore?: number
desc?: string
}
type ActPreCondition = {
tip?: string
}
type ExchangeResp = {
status?: number
msg?: string
order_id?: string
orderId?: string
exchange_info?: ExchangeInfo
exchangeInfo?: ExchangeInfo
act_pre_condition?: ActPreCondition
actPreCondition?: ActPreCondition
}
type ExchangeResult = {
uid: number
resp?: ExchangeResp
error?: string
}
type MonitorResult = {
key?: string
loop?: number
uid: number
action?: string
prize?: PrizeInfo
exchange?: ExchangeResp
error?: string
}
type RecordRow = UserPrizeInfo & {
key: string
uid: number
}
type SavedConfig = Omit<UiConfig, 'cookieText'>
function getExchangeInfo(resp?: ExchangeResp): ExchangeInfo {
return resp?.exchange_info || resp?.exchangeInfo || {}
}
function getPreCondition(resp?: ExchangeResp): ActPreCondition {
return resp?.act_pre_condition || resp?.actPreCondition || {}
}
function statusTag(status?: number, error?: string): ReactNode {
if (error) {
return <Tag color="error">失败</Tag>
}
if (status === 200) {
return <Tag color="success">成功</Tag>
}
if (status) {
return <Tag color="warning">{status}</Tag>
}
return <Tag>等待</Tag>
}
function pickConfig(values: Partial<UiConfig>): UiConfig {
return {
transport: values.transport || 'wss',
wssHost: values.wssHost || '',
sid: Number(values.sid || 0),
pid: Number(values.pid || 0),
name: values.name || '',
cookieText: values.cookieText || '',
loops: Number(values.loops || 1),
delayMs: Number(values.delayMs || 150),
concurrency: Number(values.concurrency || 1),
stopAfterSuccess: Boolean(values.stopAfterSuccess),
timeoutSec: Number(values.timeoutSec || 15),
startAt: values.startAt || '',
}
}
function readSavedConfig(): Partial<SavedConfig> {
try {
return JSON.parse(localStorage.getItem(storageKey) || '{}') as Partial<SavedConfig>
} catch {
return {}
}
}
export default function Dashboard() {
const { message } = AntApp.useApp()
const [form] = Form.useForm<UiConfig>()
const [loading, setLoading] = useState('')
const [running, setRunning] = useState(false)
const [accounts, setAccounts] = useState<AccountPreview[]>([])
const [prizes, setPrizes] = useState<PrizeInfo[]>([])
const [scores, setScores] = useState<ScoreResult[]>([])
const [records, setRecords] = useState<RecordResult[]>([])
const [results, setResults] = useState<MonitorResult[]>([])
const [logs, setLogs] = useState<LogEntry[]>([])
useEffect(() => {
let mounted = true
Promise.all([DefaultConfig(), GetLogs(), IsRunning()])
.then(([defaults, logItems, isRunning]) => {
if (!mounted) return
form.setFieldsValue({
...(defaults as UiConfig),
...readSavedConfig(),
cookieText: '',
})
setLogs((logItems || []) as LogEntry[])
setRunning(Boolean(isRunning))
})
.catch((err: unknown) => message.error(String(err)))
const offLog = EventsOn('gui:log', (entry: LogEntry) => {
setLogs((prev) => [...prev.slice(-499), entry])
})
const offResult = EventsOn('gui:monitor-result', (result: MonitorResult) => {
setResults((prev) => [normalizeMonitorResult(result), ...prev].slice(0, 300))
})
const offState = EventsOn(
'gui:monitor-state',
(state: { running?: boolean; message?: string }) => {
setRunning(Boolean(state?.running))
if (state?.message) {
message.info(state.message)
}
},
)
return () => {
mounted = false
offLog()
offResult()
offState()
}
}, [form, message])
const config = () => pickConfig(form.getFieldsValue(true))
const previewAccounts = async () => {
const items = (await PreviewAccounts(form.getFieldValue('cookieText') || '')) as AccountPreview[]
setAccounts(items || [])
}
const runAction = async <T,>(
key: string,
action: () => Promise<T>,
onDone?: (data: T) => void,
) => {
setLoading(key)
try {
const data = await action()
onDone?.(data)
message.success('完成')
} catch (err: unknown) {
message.error(String(err))
} finally {
setLoading('')
}
}
const saveSettings = () => {
const values = config()
const saved: SavedConfig = {
transport: values.transport,
wssHost: values.wssHost,
sid: values.sid,
pid: values.pid,
name: values.name,
loops: values.loops,
delayMs: values.delayMs,
concurrency: values.concurrency,
stopAfterSuccess: values.stopAfterSuccess,
timeoutSec: values.timeoutSec,
startAt: values.startAt,
}
localStorage.setItem(storageKey, JSON.stringify(saved))
message.success('已保存')
}
const prizeColumns: ColumnsType<PrizeInfo> = useMemo(
() => [
{ title: 'PID', dataIndex: 'id', width: 92 },
{ title: '名称', dataIndex: 'name', minWidth: 220, ellipsis: true },
{
title: '积分',
width: 90,
render: (_, row) => row.new_score || row.score || 0,
},
{ title: '总量', dataIndex: 'num', width: 84 },
{ title: '剩余', dataIndex: 'left_num', width: 84 },
{ title: '状态', dataIndex: 'status', width: 82 },
{ title: '比例', dataIndex: 'percent', width: 88 },
],
[],
)
const scoreColumns: ColumnsType<ScoreResult> = useMemo(
() => [
{ title: 'UID', dataIndex: 'uid', width: 140 },
{ title: '可用积分', dataIndex: 'score', width: 110 },
{
title: '状态',
width: 90,
render: (_, row) => statusTag(row.resp?.status, row.error),
},
{
title: '消息',
render: (_, row) => row.error || row.resp?.msg || '',
},
],
[],
)
const recordRows = useMemo<RecordRow[]>(() => {
const rows: RecordRow[] = []
records.forEach((item) => {
if (!item.records?.length) {
rows.push({
key: `${item.uid}-empty`,
uid: item.uid,
name: item.error || item.resp?.msg || '',
})
return
}
item.records.forEach((record, index) => {
rows.push({
key: `${item.uid}-${index}-${record.id || 'record'}`,
uid: item.uid,
...record,
})
})
})
return rows
}, [records])
const recordColumns: ColumnsType<RecordRow> = useMemo(
() => [
{ title: 'UID', dataIndex: 'uid', width: 140 },
{ title: '名称', dataIndex: 'name', minWidth: 220, ellipsis: true },
{
title: '积分',
width: 90,
render: (_, row) => row.new_score || row.score || 0,
},
{ title: '状态', dataIndex: 'status', width: 84 },
{ title: '时间', dataIndex: 'create_time', width: 130 },
],
[],
)
const resultColumns: ColumnsType<MonitorResult> = useMemo(
() => [
{ title: '轮次', dataIndex: 'loop', width: 70 },
{ title: 'UID', dataIndex: 'uid', width: 140 },
{ title: '动作', dataIndex: 'action', width: 120 },
{
title: '奖品',
minWidth: 220,
ellipsis: true,
render: (_, row) => row.prize?.name || getExchangeInfo(row.exchange).desc || '',
},
{
title: '状态',
width: 90,
render: (_, row) => statusTag(row.exchange?.status, row.error),
},
{
title: '消息',
render: (_, row) =>
row.error ||
row.exchange?.msg ||
getPreCondition(row.exchange).tip ||
row.exchange?.order_id ||
row.exchange?.orderId ||
'',
},
],
[],
)
return (
<div className="app-shell">
<aside className="side-panel">
<div className="brand-row">
<div>
<Typography.Title level={4}>虎牙抢购助手</Typography.Title>
<Typography.Text type="secondary">Wails / React / Ant Design</Typography.Text>
</div>
<Tag color={running ? 'processing' : 'default'}>
{running ? '运行中' : '空闲'}
</Tag>
</div>
<Form form={form} layout="vertical" size="small" className="config-form">
<Row gutter={8}>
<Col span={12}>
<Form.Item name="transport" label="传输">
<Select
options={[
{ value: 'wss', label: 'WSS' },
{ value: 'http', label: 'HTTP' },
]}
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="timeoutSec" label="超时">
<InputNumber min={1} max={120} addonAfter="s" className="full" />
</Form.Item>
</Col>
</Row>
<Form.Item name="wssHost" label="WSS Host">
<Input allowClear />
</Form.Item>
<Row gutter={8}>
<Col span={12}>
<Form.Item name="sid" label="SID">
<InputNumber min={1} className="full" />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="pid" label="PID">
<InputNumber min={0} className="full" />
</Form.Item>
</Col>
</Row>
<Form.Item name="name" label="名称">
<Input allowClear />
</Form.Item>
<Row gutter={8}>
<Col span={8}>
<Form.Item name="loops" label="轮次">
<InputNumber min={1} max={9999} className="full" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="delayMs" label="间隔">
<InputNumber min={10} max={60000} addonAfter="ms" className="full" />
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="concurrency" label="并发">
<InputNumber min={1} max={100} className="full" />
</Form.Item>
</Col>
</Row>
<Row gutter={8} align="middle">
<Col span={13}>
<Form.Item name="startAt" label="开始时间">
<Input placeholder="YYYY-MM-DD HH:mm:ss" allowClear />
</Form.Item>
</Col>
<Col span={11}>
<Form.Item
name="stopAfterSuccess"
label="成功停止"
valuePropName="checked"
>
<Switch />
</Form.Item>
</Col>
</Row>
<Form.Item name="cookieText" label="Cookie">
<Input.TextArea rows={8} spellCheck={false} className="cookie-box" />
</Form.Item>
</Form>
<Space wrap className="action-bar">
<Button icon={<Users size={16} />} onClick={previewAccounts}>
账号
</Button>
<Button icon={<Search size={16} />} onClick={saveSettings}>
保存
</Button>
<Button
icon={<ListChecks size={16} />}
loading={loading === 'list'}
onClick={() =>
runAction('list', () => ListPrizes(config()), (data) => {
const result = data as { prizes?: PrizeInfo[] }
setPrizes(result?.prizes || [])
})
}
>
奖品
</Button>
<Button
icon={<RefreshCw size={16} />}
loading={loading === 'score'}
onClick={() =>
runAction('score', () => QueryScores(config()), (data) => {
setScores((data || []) as ScoreResult[])
})
}
>
积分
</Button>
<Button
icon={<ClipboardList size={16} />}
loading={loading === 'records'}
onClick={() =>
runAction('records', () => GetRecords(config()), (data) => {
setRecords((data || []) as RecordResult[])
})
}
>
记录
</Button>
<Button
danger
icon={<ShoppingCart size={16} />}
loading={loading === 'exchange'}
onClick={() =>
runAction('exchange', () => Exchange(config()), (data) => {
setResults(((data || []) as ExchangeResult[]).map(normalizeExchangeResult))
})
}
>
兑换
</Button>
</Space>
<Divider />
<Space className="run-row">
<Button
type="primary"
icon={<Play size={16} />}
disabled={running}
onClick={() =>
runAction('monitor', () => StartMonitor(config()), () => {
setRunning(true)
})
}
>
开始
</Button>
<Tooltip title="停止监控">
<Button
icon={<Square size={16} />}
disabled={!running}
onClick={async () => {
await StopMonitor()
setRunning(false)
}}
/>
</Tooltip>
</Space>
<div className="account-list">
{accounts.map((item) => (
<Tag key={item.line} color={item.valid ? 'blue' : 'error'}>
{item.valid ? item.uid : `第${item.line}行`}
</Tag>
))}
</div>
</aside>
<main className="main-panel">
<Row gutter={12} className="stats-row">
<Col span={6}>
<Statistic title="账号" value={accounts.filter((item) => item.valid).length} />
</Col>
<Col span={6}>
<Statistic title="奖品" value={prizes.length} />
</Col>
<Col span={6}>
<Statistic title="积分结果" value={scores.length} />
</Col>
<Col span={6}>
<Statistic title="抢购结果" value={results.length} />
</Col>
</Row>
<Tabs
items={[
{
key: 'prizes',
label: '奖品',
children: (
<Table
size="small"
rowKey={(row) => row.id}
columns={prizeColumns}
dataSource={prizes}
pagination={{ pageSize: 12, showSizeChanger: false }}
scroll={{ x: 760 }}
/>
),
},
{
key: 'scores',
label: '积分',
children: (
<Table
size="small"
rowKey={(row) => row.uid}
columns={scoreColumns}
dataSource={scores}
pagination={{ pageSize: 12, showSizeChanger: false }}
scroll={{ x: 680 }}
/>
),
},
{
key: 'records',
label: '记录',
children: (
<Table
size="small"
rowKey={(row) => row.key}
columns={recordColumns}
dataSource={recordRows}
pagination={{ pageSize: 12, showSizeChanger: false }}
scroll={{ x: 740 }}
/>
),
},
{
key: 'results',
label: '结果',
children: (
<Table
size="small"
rowKey={(row) => row.key || `${row.uid}-${row.loop}`}
columns={resultColumns}
dataSource={results}
pagination={{ pageSize: 12, showSizeChanger: false }}
scroll={{ x: 820 }}
/>
),
},
{
key: 'logs',
label: '日志',
children: <LogView logs={logs} />,
},
]}
/>
</main>
</div>
)
}
function LogView({ logs }: { logs: LogEntry[] }) {
return (
<div className="log-view">
{logs.map((item, index) => (
<div className={`log-line level-${item.level}`} key={`${item.time}-${index}`}>
<span>{item.time}</span>
<Tag>{item.level}</Tag>
<code>{item.message}</code>
</div>
))}
</div>
)
}
function normalizeExchangeResult(row: ExchangeResult, index: number): MonitorResult {
return {
key: `exchange-${row.uid}-${index}-${Date.now()}`,
loop: 0,
uid: row.uid,
action: 'exchange',
exchange: row.resp,
error: row.error,
}
}
function normalizeMonitorResult(row: MonitorResult): MonitorResult {
return {
...row,
key: `monitor-${row.loop || 0}-${row.uid}-${Date.now()}-${Math.random()}`,
}
}
+37
View File
@@ -0,0 +1,37 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import { App as AntApp, ConfigProvider } from 'antd'
import 'antd/dist/reset.css'
import './styles.css'
import Dashboard from './App'
createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ConfigProvider
theme={{
token: {
borderRadius: 6,
colorPrimary: '#1677ff',
fontFamily:
'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
},
components: {
Button: {
controlHeight: 34,
},
Table: {
cellPaddingBlock: 8,
cellPaddingInline: 10,
},
Tabs: {
horizontalMargin: '0 0 10px',
},
},
}}
>
<AntApp>
<Dashboard />
</AntApp>
</ConfigProvider>
</React.StrictMode>,
)
+169
View File
@@ -0,0 +1,169 @@
* {
box-sizing: border-box;
}
html,
body,
#root {
width: 100%;
height: 100%;
margin: 0;
}
body {
color: #1f2937;
background: #eef2f7;
}
.app-shell {
display: grid;
grid-template-columns: 380px minmax(0, 1fr);
gap: 12px;
height: 100vh;
padding: 12px;
overflow: hidden;
}
.side-panel,
.main-panel {
min-height: 0;
border: 1px solid #d9e1ea;
border-radius: 8px;
background: #fff;
}
.side-panel {
display: flex;
flex-direction: column;
padding: 14px;
overflow: auto;
}
.main-panel {
display: flex;
flex-direction: column;
padding: 14px;
overflow: hidden;
}
.brand-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 10px;
margin-bottom: 14px;
}
.brand-row h4 {
margin: 0 0 2px;
}
.config-form .ant-form-item {
margin-bottom: 10px;
}
.full {
width: 100%;
}
.cookie-box textarea,
.cookie-box {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.action-bar {
display: flex;
margin-top: 2px;
}
.run-row {
width: 100%;
}
.run-row .ant-btn-primary {
flex: 1;
}
.account-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
min-height: 30px;
padding-top: 12px;
}
.stats-row {
margin-bottom: 12px;
}
.stats-row .ant-statistic {
padding: 10px 12px;
border: 1px solid #e5ebf2;
border-radius: 6px;
background: #f8fafc;
}
.main-panel .ant-tabs {
min-height: 0;
flex: 1;
}
.main-panel .ant-tabs-content,
.main-panel .ant-tabs-tabpane {
height: 100%;
}
.log-view {
height: calc(100vh - 170px);
min-height: 360px;
overflow: auto;
border: 1px solid #e5ebf2;
border-radius: 6px;
background: #0f172a;
padding: 10px;
}
.log-line {
display: grid;
grid-template-columns: 92px 64px minmax(0, 1fr);
align-items: start;
gap: 8px;
min-height: 24px;
color: #cbd5e1;
font-size: 12px;
line-height: 1.6;
}
.log-line code {
white-space: pre-wrap;
word-break: break-word;
color: inherit;
}
.log-line.level-error {
color: #fecaca;
}
.log-line.level-debug {
color: #93c5fd;
}
.ant-table-wrapper {
height: 100%;
}
@media (max-width: 980px) {
.app-shell {
grid-template-columns: 1fr;
overflow: auto;
}
.side-panel,
.main-panel {
overflow: visible;
}
.log-view {
height: 420px;
}
}
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ES2020"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src", "wailsjs"],
"references": [{ "path": "./tsconfig.node.json" }]
}
+10
View File
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
+10
View File
@@ -0,0 +1,10 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
clearScreen: false,
server: {
strictPort: true,
},
})
+23
View File
@@ -0,0 +1,23 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {gui} from '../models';
export function DefaultConfig():Promise<gui.Config>;
export function Exchange(arg1:gui.Config):Promise<Array<gui.ExchangeResult>>;
export function GetLogs():Promise<Array<gui.LogEntry>>;
export function GetRecords(arg1:gui.Config):Promise<Array<gui.RecordResult>>;
export function IsRunning():Promise<boolean>;
export function ListPrizes(arg1:gui.Config):Promise<gui.PrizeListResult>;
export function PreviewAccounts(arg1:string):Promise<Array<gui.AccountPreview>>;
export function QueryScores(arg1:gui.Config):Promise<Array<gui.ScoreResult>>;
export function StartMonitor(arg1:gui.Config):Promise<void>;
export function StopMonitor():Promise<boolean>;
+43
View File
@@ -0,0 +1,43 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function DefaultConfig() {
return window['go']['gui']['App']['DefaultConfig']();
}
export function Exchange(arg1) {
return window['go']['gui']['App']['Exchange'](arg1);
}
export function GetLogs() {
return window['go']['gui']['App']['GetLogs']();
}
export function GetRecords(arg1) {
return window['go']['gui']['App']['GetRecords'](arg1);
}
export function IsRunning() {
return window['go']['gui']['App']['IsRunning']();
}
export function ListPrizes(arg1) {
return window['go']['gui']['App']['ListPrizes'](arg1);
}
export function PreviewAccounts(arg1) {
return window['go']['gui']['App']['PreviewAccounts'](arg1);
}
export function QueryScores(arg1) {
return window['go']['gui']['App']['QueryScores'](arg1);
}
export function StartMonitor(arg1) {
return window['go']['gui']['App']['StartMonitor'](arg1);
}
export function StopMonitor() {
return window['go']['gui']['App']['StopMonitor']();
}
+488
View File
@@ -0,0 +1,488 @@
export namespace gui {
export class AccountPreview {
line: number;
uid: number;
valid: boolean;
error?: string;
static createFrom(source: any = {}) {
return new AccountPreview(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.line = source["line"];
this.uid = source["uid"];
this.valid = source["valid"];
this.error = source["error"];
}
}
export class Config {
transport: string;
wssHost: string;
sid: number;
pid: number;
name: string;
cookieText: string;
loops: number;
delayMs: number;
concurrency: number;
stopAfterSuccess: boolean;
timeoutSec: number;
startAt: string;
static createFrom(source: any = {}) {
return new Config(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.transport = source["transport"];
this.wssHost = source["wssHost"];
this.sid = source["sid"];
this.pid = source["pid"];
this.name = source["name"];
this.cookieText = source["cookieText"];
this.loops = source["loops"];
this.delayMs = source["delayMs"];
this.concurrency = source["concurrency"];
this.stopAfterSuccess = source["stopAfterSuccess"];
this.timeoutSec = source["timeoutSec"];
this.startAt = source["startAt"];
}
}
export class ExchangeResult {
uid: number;
resp?: huya.ScoreExchangePrizeResp;
error?: string;
static createFrom(source: any = {}) {
return new ExchangeResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.uid = source["uid"];
this.resp = this.convertValues(source["resp"], huya.ScoreExchangePrizeResp);
this.error = source["error"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class LogEntry {
time: string;
level: string;
message: string;
static createFrom(source: any = {}) {
return new LogEntry(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.time = source["time"];
this.level = source["level"];
this.message = source["message"];
}
}
export class PrizeListResult {
uid: number;
status: number;
msg: string;
prizes: huya.PrizeInfo[];
raw?: huya.GetActPrizeListResp;
static createFrom(source: any = {}) {
return new PrizeListResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.uid = source["uid"];
this.status = source["status"];
this.msg = source["msg"];
this.prizes = this.convertValues(source["prizes"], huya.PrizeInfo);
this.raw = this.convertValues(source["raw"], huya.GetActPrizeListResp);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class RecordResult {
uid: number;
records: huya.UserPrizeInfo[];
resp?: huya.GetUserPrizeRecordsResp;
error?: string;
static createFrom(source: any = {}) {
return new RecordResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.uid = source["uid"];
this.records = this.convertValues(source["records"], huya.UserPrizeInfo);
this.resp = this.convertValues(source["resp"], huya.GetUserPrizeRecordsResp);
this.error = source["error"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class ScoreResult {
uid: number;
score: number;
resp?: huya.GetUserScoreResp;
error?: string;
static createFrom(source: any = {}) {
return new ScoreResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.uid = source["uid"];
this.score = source["score"];
this.resp = this.convertValues(source["resp"], huya.GetUserScoreResp);
this.error = source["error"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
export namespace huya {
export class ActPreCondition {
condition_type: number;
condition_params?: Record<string, string>;
tip?: string;
jump_url?: string;
button_desc?: string;
static createFrom(source: any = {}) {
return new ActPreCondition(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.condition_type = source["condition_type"];
this.condition_params = source["condition_params"];
this.tip = source["tip"];
this.jump_url = source["jump_url"];
this.button_desc = source["button_desc"];
}
}
export class ExchangeInfo {
pid: number;
exchange_score: number;
desc: string;
static createFrom(source: any = {}) {
return new ExchangeInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.pid = source["pid"];
this.exchange_score = source["exchange_score"];
this.desc = source["desc"];
}
}
export class PrizeTag {
id: number;
name: string;
weight: number;
static createFrom(source: any = {}) {
return new PrizeTag(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.name = source["name"];
this.weight = source["weight"];
}
}
export class PrizeInfo {
id: number;
sid: number;
name: string;
score: number;
type: number;
img?: string;
sort: number;
frequency: number;
frequency_limit: number;
create_time: number;
num: number;
status: number;
percent: string;
new_score: number;
tags?: string;
left_num: number;
is_show_num: number;
static createFrom(source: any = {}) {
return new PrizeInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.sid = source["sid"];
this.name = source["name"];
this.score = source["score"];
this.type = source["type"];
this.img = source["img"];
this.sort = source["sort"];
this.frequency = source["frequency"];
this.frequency_limit = source["frequency_limit"];
this.create_time = source["create_time"];
this.num = source["num"];
this.status = source["status"];
this.percent = source["percent"];
this.new_score = source["new_score"];
this.tags = source["tags"];
this.left_num = source["left_num"];
this.is_show_num = source["is_show_num"];
}
}
export class GetActPrizeListResp {
status: number;
msg: string;
prizes: PrizeInfo[];
module_id: number;
tags: PrizeTag[];
static createFrom(source: any = {}) {
return new GetActPrizeListResp(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.status = source["status"];
this.msg = source["msg"];
this.prizes = this.convertValues(source["prizes"], PrizeInfo);
this.module_id = source["module_id"];
this.tags = this.convertValues(source["tags"], PrizeTag);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class UserPrizeInfo {
id: number;
name: string;
score: number;
create_time: number;
status: number;
type: number;
is_real: number;
new_score: number;
account?: string;
code?: string;
common_prize_type: number;
static createFrom(source: any = {}) {
return new UserPrizeInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.name = source["name"];
this.score = source["score"];
this.create_time = source["create_time"];
this.status = source["status"];
this.type = source["type"];
this.is_real = source["is_real"];
this.new_score = source["new_score"];
this.account = source["account"];
this.code = source["code"];
this.common_prize_type = source["common_prize_type"];
}
}
export class GetUserPrizeRecordsResp {
status: number;
msg: string;
records: UserPrizeInfo[];
static createFrom(source: any = {}) {
return new GetUserPrizeRecordsResp(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.status = source["status"];
this.msg = source["msg"];
this.records = this.convertValues(source["records"], UserPrizeInfo);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class GetUserScoreResp {
status: number;
msg: string;
gain_score: number;
used_score: number;
new_gain_score: number;
new_used_score: number;
score: number;
is_open_exchange_tip: number;
static createFrom(source: any = {}) {
return new GetUserScoreResp(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.status = source["status"];
this.msg = source["msg"];
this.gain_score = source["gain_score"];
this.used_score = source["used_score"];
this.new_gain_score = source["new_gain_score"];
this.new_used_score = source["new_used_score"];
this.score = source["score"];
this.is_open_exchange_tip = source["is_open_exchange_tip"];
}
}
export class ScoreExchangePrizeResp {
status: number;
msg: string;
order_id?: string;
exchange_info: ExchangeInfo;
act_pre_condition: ActPreCondition;
static createFrom(source: any = {}) {
return new ScoreExchangePrizeResp(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.status = source["status"];
this.msg = source["msg"];
this.order_id = source["order_id"];
this.exchange_info = this.convertValues(source["exchange_info"], ExchangeInfo);
this.act_pre_condition = this.convertValues(source["act_pre_condition"], ActPreCondition);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"name": "@wailsapp/runtime",
"version": "2.0.0",
"description": "Wails Javascript runtime library",
"main": "runtime.js",
"types": "runtime.d.ts",
"scripts": {
},
"repository": {
"type": "git",
"url": "git+https://github.com/wailsapp/wails.git"
},
"keywords": [
"Wails",
"Javascript",
"Go"
],
"author": "Lea Anthony <lea.anthony@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/wailsapp/wails/issues"
},
"homepage": "https://github.com/wailsapp/wails#readme"
}
+330
View File
@@ -0,0 +1,330 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export interface Position {
x: number;
y: number;
}
export interface Size {
w: number;
h: number;
}
export interface Screen {
isCurrent: boolean;
isPrimary: boolean;
width : number
height : number
}
// Environment information such as platform, buildtype, ...
export interface EnvironmentInfo {
buildType: string;
platform: string;
arch: string;
}
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
// emits the given event. Optional data may be passed with the event.
// This will trigger any event listeners.
export function EventsEmit(eventName: string, ...data: any): void;
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
// sets up a listener for the given event name, but will only trigger a given number times.
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
// sets up a listener for the given event name, but will only trigger once.
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
// unregisters the listener for the given event name.
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
// logs the given message at the `trace` log level.
export function LogTrace(message: string): void;
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
// logs the given message at the `debug` log level.
export function LogDebug(message: string): void;
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
// logs the given message at the `error` log level.
export function LogError(message: string): void;
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
// logs the given message at the `fatal` log level.
// The application will quit after calling this method.
export function LogFatal(message: string): void;
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
// logs the given message at the `info` log level.
export function LogInfo(message: string): void;
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
// logs the given message at the `warning` log level.
export function LogWarning(message: string): void;
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
// Forces a reload by the main application as well as connected browsers.
export function WindowReload(): void;
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
// Reloads the application frontend.
export function WindowReloadApp(): void;
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
// Sets the window AlwaysOnTop or not on top.
export function WindowSetAlwaysOnTop(b: boolean): void;
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
// *Windows only*
// Sets window theme to system default (dark/light).
export function WindowSetSystemDefaultTheme(): void;
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
// *Windows only*
// Sets window to light theme.
export function WindowSetLightTheme(): void;
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
// *Windows only*
// Sets window to dark theme.
export function WindowSetDarkTheme(): void;
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
// Centers the window on the monitor the window is currently on.
export function WindowCenter(): void;
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
// Sets the text in the window title bar.
export function WindowSetTitle(title: string): void;
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
// Makes the window full screen.
export function WindowFullscreen(): void;
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
// Restores the previous window dimensions and position prior to full screen.
export function WindowUnfullscreen(): void;
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
export function WindowIsFullscreen(): Promise<boolean>;
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
// Sets the width and height of the window.
export function WindowSetSize(width: number, height: number): void;
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
// Gets the width and height of the window.
export function WindowGetSize(): Promise<Size>;
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
// Setting a size of 0,0 will disable this constraint.
export function WindowSetMaxSize(width: number, height: number): void;
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
// Setting a size of 0,0 will disable this constraint.
export function WindowSetMinSize(width: number, height: number): void;
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
// Sets the window position relative to the monitor the window is currently on.
export function WindowSetPosition(x: number, y: number): void;
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
// Gets the window position relative to the monitor the window is currently on.
export function WindowGetPosition(): Promise<Position>;
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
// Hides the window.
export function WindowHide(): void;
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
// Shows the window, if it is currently hidden.
export function WindowShow(): void;
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
// Maximises the window to fill the screen.
export function WindowMaximise(): void;
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
// Toggles between Maximised and UnMaximised.
export function WindowToggleMaximise(): void;
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
// Restores the window to the dimensions and position prior to maximising.
export function WindowUnmaximise(): void;
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
// Returns the state of the window, i.e. whether the window is maximised or not.
export function WindowIsMaximised(): Promise<boolean>;
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
// Minimises the window.
export function WindowMinimise(): void;
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
// Restores the window to the dimensions and position prior to minimising.
export function WindowUnminimise(): void;
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
// Returns the state of the window, i.e. whether the window is minimised or not.
export function WindowIsMinimised(): Promise<boolean>;
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
// Returns the state of the window, i.e. whether the window is normal or not.
export function WindowIsNormal(): Promise<boolean>;
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
export function ScreenGetAll(): Promise<Screen[]>;
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
// Opens the given URL in the system browser.
export function BrowserOpenURL(url: string): void;
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
// Returns information about the environment
export function Environment(): Promise<EnvironmentInfo>;
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
// Quits the application.
export function Quit(): void;
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
// Hides the application.
export function Hide(): void;
// [Show](https://wails.io/docs/reference/runtime/intro#show)
// Shows the application.
export function Show(): void;
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
// Returns the current text stored on clipboard
export function ClipboardGetText(): Promise<string>;
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
// Sets a text on the clipboard
export function ClipboardSetText(text: string): Promise<boolean>;
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
// OnFileDropOff removes the drag and drop listeners and handlers.
export function OnFileDropOff() :void
// Check if the file path resolver is available
export function CanResolveFilePaths(): boolean;
// Resolves file paths for an array of files
export function ResolveFilePaths(files: File[]): void
// Notification types
export interface NotificationOptions {
id: string;
title: string;
subtitle?: string; // macOS and Linux only
body?: string;
categoryId?: string;
data?: { [key: string]: any };
}
export interface NotificationAction {
id?: string;
title?: string;
destructive?: boolean; // macOS-specific
}
export interface NotificationCategory {
id?: string;
actions?: NotificationAction[];
hasReplyField?: boolean;
replyPlaceholder?: string;
replyButtonTitle?: string;
}
// [InitializeNotifications](https://wails.io/docs/reference/runtime/notification#initializenotifications)
// Initializes the notification service for the application.
// This must be called before sending any notifications.
export function InitializeNotifications(): Promise<void>;
// [CleanupNotifications](https://wails.io/docs/reference/runtime/notification#cleanupnotifications)
// Cleans up notification resources and releases any held connections.
export function CleanupNotifications(): Promise<void>;
// [IsNotificationAvailable](https://wails.io/docs/reference/runtime/notification#isnotificationavailable)
// Checks if notifications are available on the current platform.
export function IsNotificationAvailable(): Promise<boolean>;
// [RequestNotificationAuthorization](https://wails.io/docs/reference/runtime/notification#requestnotificationauthorization)
// Requests notification authorization from the user (macOS only).
export function RequestNotificationAuthorization(): Promise<boolean>;
// [CheckNotificationAuthorization](https://wails.io/docs/reference/runtime/notification#checknotificationauthorization)
// Checks the current notification authorization status (macOS only).
export function CheckNotificationAuthorization(): Promise<boolean>;
// [SendNotification](https://wails.io/docs/reference/runtime/notification#sendnotification)
// Sends a basic notification with the given options.
export function SendNotification(options: NotificationOptions): Promise<void>;
// [SendNotificationWithActions](https://wails.io/docs/reference/runtime/notification#sendnotificationwithactions)
// Sends a notification with action buttons. Requires a registered category.
export function SendNotificationWithActions(options: NotificationOptions): Promise<void>;
// [RegisterNotificationCategory](https://wails.io/docs/reference/runtime/notification#registernotificationcategory)
// Registers a notification category that can be used with SendNotificationWithActions.
export function RegisterNotificationCategory(category: NotificationCategory): Promise<void>;
// [RemoveNotificationCategory](https://wails.io/docs/reference/runtime/notification#removenotificationcategory)
// Removes a previously registered notification category.
export function RemoveNotificationCategory(categoryId: string): Promise<void>;
// [RemoveAllPendingNotifications](https://wails.io/docs/reference/runtime/notification#removeallpendingnotifications)
// Removes all pending notifications from the notification center.
export function RemoveAllPendingNotifications(): Promise<void>;
// [RemovePendingNotification](https://wails.io/docs/reference/runtime/notification#removependingnotification)
// Removes a specific pending notification by its identifier.
export function RemovePendingNotification(identifier: string): Promise<void>;
// [RemoveAllDeliveredNotifications](https://wails.io/docs/reference/runtime/notification#removealldeliverednotifications)
// Removes all delivered notifications from the notification center.
export function RemoveAllDeliveredNotifications(): Promise<void>;
// [RemoveDeliveredNotification](https://wails.io/docs/reference/runtime/notification#removedeliverednotification)
// Removes a specific delivered notification by its identifier.
export function RemoveDeliveredNotification(identifier: string): Promise<void>;
// [RemoveNotification](https://wails.io/docs/reference/runtime/notification#removenotification)
// Removes a notification by its identifier (cross-platform convenience function).
export function RemoveNotification(identifier: string): Promise<void>;
+298
View File
@@ -0,0 +1,298 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export function LogPrint(message) {
window.runtime.LogPrint(message);
}
export function LogTrace(message) {
window.runtime.LogTrace(message);
}
export function LogDebug(message) {
window.runtime.LogDebug(message);
}
export function LogInfo(message) {
window.runtime.LogInfo(message);
}
export function LogWarning(message) {
window.runtime.LogWarning(message);
}
export function LogError(message) {
window.runtime.LogError(message);
}
export function LogFatal(message) {
window.runtime.LogFatal(message);
}
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
}
export function EventsOn(eventName, callback) {
return EventsOnMultiple(eventName, callback, -1);
}
export function EventsOff(eventName, ...additionalEventNames) {
return window.runtime.EventsOff(eventName, ...additionalEventNames);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
return EventsOnMultiple(eventName, callback, 1);
}
export function EventsEmit(eventName) {
let args = [eventName].slice.call(arguments);
return window.runtime.EventsEmit.apply(null, args);
}
export function WindowReload() {
window.runtime.WindowReload();
}
export function WindowReloadApp() {
window.runtime.WindowReloadApp();
}
export function WindowSetAlwaysOnTop(b) {
window.runtime.WindowSetAlwaysOnTop(b);
}
export function WindowSetSystemDefaultTheme() {
window.runtime.WindowSetSystemDefaultTheme();
}
export function WindowSetLightTheme() {
window.runtime.WindowSetLightTheme();
}
export function WindowSetDarkTheme() {
window.runtime.WindowSetDarkTheme();
}
export function WindowCenter() {
window.runtime.WindowCenter();
}
export function WindowSetTitle(title) {
window.runtime.WindowSetTitle(title);
}
export function WindowFullscreen() {
window.runtime.WindowFullscreen();
}
export function WindowUnfullscreen() {
window.runtime.WindowUnfullscreen();
}
export function WindowIsFullscreen() {
return window.runtime.WindowIsFullscreen();
}
export function WindowGetSize() {
return window.runtime.WindowGetSize();
}
export function WindowSetSize(width, height) {
window.runtime.WindowSetSize(width, height);
}
export function WindowSetMaxSize(width, height) {
window.runtime.WindowSetMaxSize(width, height);
}
export function WindowSetMinSize(width, height) {
window.runtime.WindowSetMinSize(width, height);
}
export function WindowSetPosition(x, y) {
window.runtime.WindowSetPosition(x, y);
}
export function WindowGetPosition() {
return window.runtime.WindowGetPosition();
}
export function WindowHide() {
window.runtime.WindowHide();
}
export function WindowShow() {
window.runtime.WindowShow();
}
export function WindowMaximise() {
window.runtime.WindowMaximise();
}
export function WindowToggleMaximise() {
window.runtime.WindowToggleMaximise();
}
export function WindowUnmaximise() {
window.runtime.WindowUnmaximise();
}
export function WindowIsMaximised() {
return window.runtime.WindowIsMaximised();
}
export function WindowMinimise() {
window.runtime.WindowMinimise();
}
export function WindowUnminimise() {
window.runtime.WindowUnminimise();
}
export function WindowSetBackgroundColour(R, G, B, A) {
window.runtime.WindowSetBackgroundColour(R, G, B, A);
}
export function ScreenGetAll() {
return window.runtime.ScreenGetAll();
}
export function WindowIsMinimised() {
return window.runtime.WindowIsMinimised();
}
export function WindowIsNormal() {
return window.runtime.WindowIsNormal();
}
export function BrowserOpenURL(url) {
window.runtime.BrowserOpenURL(url);
}
export function Environment() {
return window.runtime.Environment();
}
export function Quit() {
window.runtime.Quit();
}
export function Hide() {
window.runtime.Hide();
}
export function Show() {
window.runtime.Show();
}
export function ClipboardGetText() {
return window.runtime.ClipboardGetText();
}
export function ClipboardSetText(text) {
return window.runtime.ClipboardSetText(text);
}
/**
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
*
* @export
* @callback OnFileDropCallback
* @param {number} x - x coordinate of the drop
* @param {number} y - y coordinate of the drop
* @param {string[]} paths - A list of file paths.
*/
/**
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
*
* @export
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
*/
export function OnFileDrop(callback, useDropTarget) {
return window.runtime.OnFileDrop(callback, useDropTarget);
}
/**
* OnFileDropOff removes the drag and drop listeners and handlers.
*/
export function OnFileDropOff() {
return window.runtime.OnFileDropOff();
}
export function CanResolveFilePaths() {
return window.runtime.CanResolveFilePaths();
}
export function ResolveFilePaths(files) {
return window.runtime.ResolveFilePaths(files);
}
export function InitializeNotifications() {
return window.runtime.InitializeNotifications();
}
export function CleanupNotifications() {
return window.runtime.CleanupNotifications();
}
export function IsNotificationAvailable() {
return window.runtime.IsNotificationAvailable();
}
export function RequestNotificationAuthorization() {
return window.runtime.RequestNotificationAuthorization();
}
export function CheckNotificationAuthorization() {
return window.runtime.CheckNotificationAuthorization();
}
export function SendNotification(options) {
return window.runtime.SendNotification(options);
}
export function SendNotificationWithActions(options) {
return window.runtime.SendNotificationWithActions(options);
}
export function RegisterNotificationCategory(category) {
return window.runtime.RegisterNotificationCategory(category);
}
export function RemoveNotificationCategory(categoryId) {
return window.runtime.RemoveNotificationCategory(categoryId);
}
export function RemoveAllPendingNotifications() {
return window.runtime.RemoveAllPendingNotifications();
}
export function RemovePendingNotification(identifier) {
return window.runtime.RemovePendingNotification(identifier);
}
export function RemoveAllDeliveredNotifications() {
return window.runtime.RemoveAllDeliveredNotifications();
}
export function RemoveDeliveredNotification(identifier) {
return window.runtime.RemoveDeliveredNotification(identifier);
}
export function RemoveNotification(identifier) {
return window.runtime.RemoveNotification(identifier);
}