summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorHaishan <[email protected]>2022-06-06 23:39:56 +0800
committerHaishan <[email protected]>2022-06-06 23:39:56 +0800
commit78f3434cb52f53c66936de278f0828c19ef63666 (patch)
treee7f9685cc0f3d8eaa6a94ad330e8876752ecb276 /src/api
parent23e734aa548354bb7ceff5ad8d85de95cd860a55 (diff)
Run prettier
Diffstat (limited to 'src/api')
-rw-r--r--src/api/configs.ts5
-rw-r--r--src/api/connections.ts5
-rw-r--r--src/api/proxies.ts5
-rw-r--r--src/api/rule-provider.ts5
-rw-r--r--src/api/rules.ts4
-rw-r--r--src/api/traffic.ts2
6 files changed, 6 insertions, 20 deletions
diff --git a/src/api/configs.ts b/src/api/configs.ts
index 69b02d4..3646f1a 100644
--- a/src/api/configs.ts
+++ b/src/api/configs.ts
@@ -22,10 +22,7 @@ function configsPatchWorkaround(o: ClashConfigPartial) {
return o;
}
-export async function updateConfigs(
- apiConfig: ClashAPIConfig,
- o: ClashConfigPartial
-) {
+export async function updateConfigs(apiConfig: ClashAPIConfig, o: ClashConfigPartial) {
const { url, init } = getURLAndInit(apiConfig);
const body = JSON.stringify(configsPatchWorkaround(o));
return await fetch(url + endpoint, { ...init, body, method: 'PATCH' });
diff --git a/src/api/connections.ts b/src/api/connections.ts
index 9c94d31..60fd4c5 100644
--- a/src/api/connections.ts
+++ b/src/api/connections.ts
@@ -51,10 +51,7 @@ function appendData(s: string) {
type UnsubscribeFn = () => void;
let wsState: number;
-export function fetchData(
- apiConfig: ClashAPIConfig,
- listener: unknown
-): UnsubscribeFn | void {
+export function fetchData(apiConfig: ClashAPIConfig, listener: unknown): UnsubscribeFn | void {
if (fetched || wsState === 1) {
if (listener) return subscribe(listener);
}
diff --git a/src/api/proxies.ts b/src/api/proxies.ts
index 6b3e28e..e11fd9e 100644
--- a/src/api/proxies.ts
+++ b/src/api/proxies.ts
@@ -59,8 +59,5 @@ export async function updateProviderByName(config, name) {
export async function healthcheckProviderByName(config, name) {
const { url, init } = getURLAndInit(config);
const options = { ...init, method: 'GET' };
- return await fetch(
- url + '/providers/proxies/' + name + '/healthcheck',
- options
- );
+ return await fetch(url + '/providers/proxies/' + name + '/healthcheck', options);
}
diff --git a/src/api/rule-provider.ts b/src/api/rule-provider.ts
index ec9fa7b..5ecd61e 100644
--- a/src/api/rule-provider.ts
+++ b/src/api/rule-provider.ts
@@ -31,10 +31,7 @@ function normalizeAPIResponse(data: RuleProviderAPIData) {
return { byName, names };
}
-export async function fetchRuleProviders(
- endpoint: string,
- apiConfig: ClashAPIConfig
-) {
+export async function fetchRuleProviders(endpoint: string, apiConfig: ClashAPIConfig) {
const { url, init } = getURLAndInit(apiConfig);
let data = { providers: {} };
diff --git a/src/api/rules.ts b/src/api/rules.ts
index b57b0e3..4d18c23 100644
--- a/src/api/rules.ts
+++ b/src/api/rules.ts
@@ -12,9 +12,7 @@ type RuleAPIItem = {
proxy: string;
};
-function normalizeAPIResponse(json: {
- rules: Array<RuleAPIItem>;
-}): Array<RuleItem> {
+function normalizeAPIResponse(json: { rules: Array<RuleAPIItem> }): Array<RuleItem> {
invariant(
json.rules && json.rules.length >= 0,
'there is no valid rules list in the rules API response'
diff --git a/src/api/traffic.ts b/src/api/traffic.ts
index cd18aac..aa9143c 100644
--- a/src/api/traffic.ts
+++ b/src/api/traffic.ts
@@ -27,7 +27,7 @@ const traffic = {
this.subscribers.forEach((f) => f(o));
},
- subscribe(listener: (x:any) => void) {
+ subscribe(listener: (x: any) => void) {
this.subscribers.push(listener);
return () => {
const idx = this.subscribers.indexOf(listener);