mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 14:01:56 +08:00
All: infra update
This commit is contained in:
parent
614a20b684
commit
19554b1ab8
@ -1,6 +1,7 @@
|
||||
extends:
|
||||
- standard-with-typescript
|
||||
- react-app
|
||||
- airbnb/hooks
|
||||
- plugin:@typescript-eslint/recommended
|
||||
parser: '@typescript-eslint/parser'
|
||||
parserOptions:
|
||||
project: './tsconfig.json'
|
||||
@ -26,4 +27,3 @@ rules:
|
||||
'@typescript-eslint/promise-function-async': off
|
||||
'@typescript-eslint/no-floating-promises': off
|
||||
'@typescript-eslint/no-invalid-void-type': off
|
||||
'@typescript-eslint/no-misused-promises': off
|
||||
|
@ -42,13 +42,13 @@ defaults delete com.west2online.ClashX webviewUrl
|
||||
This command will start Clash Dashboard at `http://localhost:8080/`
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
$ pnpm start
|
||||
```
|
||||
|
||||
### Build for production
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
$ pnpm build
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
54
package.json
54
package.json
@ -19,53 +19,51 @@
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "yarn lint:ts",
|
||||
"lint": "pnpm lint:ts",
|
||||
"lint:ts": "eslint --ext=jsx,ts,tsx --fix src",
|
||||
"contributors:add": "all-contributors add",
|
||||
"contributors:generate": "all-contributors generate"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.15.7",
|
||||
"@babel/eslint-parser": "^7.16.0",
|
||||
"@types/lodash-es": "^4.17.5",
|
||||
"@types/node": "^16.10.2",
|
||||
"@types/react": "^17.0.26",
|
||||
"@types/react-dom": "^17.0.9",
|
||||
"@types/react-router-dom": "^5.3.0",
|
||||
"@types/react-table": "^7.7.5",
|
||||
"@types/node": "^16.11.6",
|
||||
"@types/react": "^17.0.34",
|
||||
"@types/react-dom": "^17.0.11",
|
||||
"@types/react-router-dom": "^5.3.2",
|
||||
"@types/react-table": "^7.7.7",
|
||||
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
||||
"@types/react-window": "^1.8.5",
|
||||
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
||||
"@typescript-eslint/parser": "^4.32.0",
|
||||
"@vitejs/plugin-react": "^1.0.1",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-react-app": "^6.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
||||
"@typescript-eslint/parser": "^5.3.0",
|
||||
"@vitejs/plugin-react": "^1.0.7",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-config-airbnb-typescript": "^14.0.1",
|
||||
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||
"eslint-import-resolver-typescript": "^2.5.0",
|
||||
"eslint-plugin-flowtype": "^6.1.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-react": "^7.26.1",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"sass": "^1.42.1",
|
||||
"type-fest": "^2.3.4",
|
||||
"typescript": "^4.4.3",
|
||||
"vite": "^2.6.2",
|
||||
"vite-plugin-pwa": "^0.11.2",
|
||||
"vite-plugin-windicss": "^1.4.8",
|
||||
"vite-tsconfig-paths": "^3.3.14",
|
||||
"windicss": "^3.1.8"
|
||||
"sass": "^1.43.4",
|
||||
"type-fest": "^2.5.2",
|
||||
"typescript": "^4.4.4",
|
||||
"vite": "^2.6.13",
|
||||
"vite-plugin-pwa": "^0.11.3",
|
||||
"vite-plugin-windicss": "^1.4.12",
|
||||
"vite-tsconfig-paths": "^3.3.17",
|
||||
"windicss": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.22.0",
|
||||
"axios": "^0.24.0",
|
||||
"classnames": "^2.3.1",
|
||||
"dayjs": "^1.10.7",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"immer": "^9.0.6",
|
||||
"jotai": "^1.3.6",
|
||||
"jotai": "^1.4.2",
|
||||
"lodash-es": "^4.17.21",
|
||||
"neverthrow": "^4.2.2",
|
||||
"neverthrow": "^4.3.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-router-dom": "^5.3.0",
|
||||
|
2004
pnpm-lock.yaml
generated
2004
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
2
src/assets/index.d.ts
vendored
2
src/assets/index.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare module '*.png'
|
||||
declare module '*.svg'
|
@ -79,7 +79,7 @@ export function Select (props: SelectProps) {
|
||||
}, [value, children])
|
||||
|
||||
const hookedChildren = useMemo(() => {
|
||||
return Children.map(children ?? [], (child: React.ReactElement<any>) => {
|
||||
return Children.map(children ?? [], child => {
|
||||
if (!child.props || !child.type) {
|
||||
return child
|
||||
}
|
||||
|
@ -27,28 +27,28 @@ enum Columns {
|
||||
Upload = 'upload',
|
||||
Download = 'download',
|
||||
SourceIP = 'sourceIP',
|
||||
Time = 'time'
|
||||
Time = 'time',
|
||||
}
|
||||
|
||||
const shouldCenter = new Set<string>([Columns.Network, Columns.Type, Columns.Rule, Columns.Speed, Columns.Upload, Columns.Download, Columns.SourceIP, Columns.Time])
|
||||
|
||||
interface TableColumn<D extends object = {}> extends
|
||||
interface TableColumn<D extends object> extends
|
||||
ColumnInstance<D>,
|
||||
UseSortByColumnProps<D>,
|
||||
UseResizeColumnsColumnProps<D> {}
|
||||
|
||||
type TableColumnOption<D extends object = {}> =
|
||||
type TableColumnOption<D extends object> =
|
||||
Column<D> &
|
||||
UseResizeColumnsOptions<D> &
|
||||
UseFiltersColumnOptions<D> &
|
||||
UseSortByColumnOptions<D>
|
||||
|
||||
interface ITableOptions<D extends object = {}> extends
|
||||
interface ITableOptions<D extends object> extends
|
||||
TableOptions<D>,
|
||||
UseSortByOptions<D>,
|
||||
UseFiltersOptions<D> {}
|
||||
|
||||
interface ITableInstance<D extends object = {}> extends
|
||||
interface ITableInstance<D extends object> extends
|
||||
TableInstance<D>,
|
||||
UseFiltersInstanceProps<D> {}
|
||||
|
||||
|
@ -26,6 +26,7 @@ export interface FormatConnection {
|
||||
|
||||
class Store {
|
||||
protected connections = new Map<string, Connection>()
|
||||
|
||||
protected saveDisconnection = false
|
||||
|
||||
appendToSet (connections: API.Connections[]) {
|
||||
|
@ -12,7 +12,7 @@ import './style.scss'
|
||||
enum sortType {
|
||||
None,
|
||||
Asc,
|
||||
Desc
|
||||
Desc,
|
||||
}
|
||||
|
||||
const sortMap = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import EventEmitter from 'eventemitter3'
|
||||
|
||||
export enum Action {
|
||||
SPEED_NOTIFY = 'speed-notify'
|
||||
SPEED_NOTIFY = 'speed-notify',
|
||||
}
|
||||
|
||||
class Event {
|
||||
|
@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
export function noop () {}
|
||||
|
||||
export function partition<T> (arr: T[], fn: (arg: T) => boolean): [T[], T[]] {
|
||||
|
@ -12,7 +12,7 @@ export function useObject<T extends Record<string, unknown>> (initialValue: T) {
|
||||
function set (data: Partial<T>): void
|
||||
function set (f: (draft: Draft<T>) => void | T): void
|
||||
function set<K extends keyof Draft<T>> (key: K, value: Draft<T>[K]): void
|
||||
function set<K extends keyof Draft<T>> (data: any, value?: Draft<T>[K]): void {
|
||||
function set<K extends keyof Draft<T>> (data: unknown, value?: Draft<T>[K]): void {
|
||||
if (typeof data === 'string') {
|
||||
rawSet(draft => {
|
||||
const key = data as K
|
||||
@ -20,7 +20,7 @@ export function useObject<T extends Record<string, unknown>> (initialValue: T) {
|
||||
draft[key] = v!
|
||||
})
|
||||
} else if (typeof data === 'function') {
|
||||
rawSet(data)
|
||||
rawSet(data as (draft: Draft<T>) => void | T)
|
||||
} else if (typeof data === 'object') {
|
||||
rawSet((draft: Draft<T>) => {
|
||||
const obj = data as Draft<T>
|
||||
|
@ -8,7 +8,7 @@ export function useWarpImmerSetter<T> (setter: (f: WritableDraft<T>) => void) {
|
||||
function set<K extends keyof Draft<T>> (key: K, value: Draft<T>[K]): void
|
||||
function set (data: Partial<T>): void
|
||||
function set (f: (draft: Draft<T>) => void | T): void
|
||||
function set<K extends keyof Draft<T>> (data: any, value?: Draft<T>[K]): void {
|
||||
function set<K extends keyof Draft<T>> (data: unknown, value?: Draft<T>[K]): void {
|
||||
if (typeof data === 'string') {
|
||||
setter((draft: Draft<T>) => {
|
||||
const key = data as K
|
||||
|
@ -20,12 +20,12 @@ export interface JsBridgeAPI {
|
||||
/**
|
||||
* Register a javascript bridge event handle
|
||||
*/
|
||||
registerHandler: (eventName: string, callback?: (data: any, responseCallback: (param: any) => void) => void) => void
|
||||
registerHandler: <D, P>(eventName: string, callback?: (data: D, responseCallback: (param: P) => void) => void) => void
|
||||
|
||||
/**
|
||||
* Call a native handle
|
||||
*/
|
||||
callHandler: <T>(handleName: string, data?: any, responseCallback?: (responseData: T) => void) => void
|
||||
callHandler: <T, D>(handleName: string, data?: D, responseCallback?: (responseData: T) => void) => void
|
||||
|
||||
/**
|
||||
* Who knows
|
||||
@ -115,7 +115,7 @@ export class JsBridge {
|
||||
setTimeout(() => document.documentElement.removeChild(WVJBIframe), 0)
|
||||
}
|
||||
|
||||
public async callHandler<T> (handleName: string, data?: any) {
|
||||
public async callHandler<T, D = unknown> (handleName: string, data?: D) {
|
||||
return await new Promise<T>((resolve) => {
|
||||
this.instance?.callHandler(
|
||||
handleName,
|
||||
|
@ -95,6 +95,7 @@ export interface Connections {
|
||||
|
||||
export class Client {
|
||||
private readonly axiosClient: AxiosInstance
|
||||
|
||||
constructor (url: string, secret?: string) {
|
||||
this.axiosClient = axios.create({
|
||||
baseURL: url,
|
||||
|
@ -12,8 +12,11 @@ export interface Config {
|
||||
|
||||
export class StreamReader<T> {
|
||||
protected EE = new EventEmitter()
|
||||
|
||||
protected config: SetRequired<Config, 'bufferLength' | 'retryInterval'>
|
||||
|
||||
protected innerBuffer: T[] = []
|
||||
|
||||
protected isClose = false
|
||||
|
||||
constructor (config: Config) {
|
||||
|
@ -8,15 +8,13 @@ export enum RuleType {
|
||||
SrcPort = 'SrcPort',
|
||||
DstPort = 'DstPort',
|
||||
MATCH = 'MATCH',
|
||||
RuleSet = 'RuleSet'
|
||||
RuleSet = 'RuleSet',
|
||||
}
|
||||
|
||||
export interface Rule {
|
||||
|
||||
type?: RuleType
|
||||
|
||||
payload?: string
|
||||
|
||||
proxy?: string // proxy or proxy group name
|
||||
|
||||
}
|
||||
|
@ -6,13 +6,11 @@
|
||||
],
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"types": ["vite/client"],
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user