-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
141 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,50 @@ | ||
import { interpolate } from '@chatgpt-telegram-workers/interp'; | ||
import { interpolate } from '@chatgpt-telegram-workers/plugins'; | ||
|
||
export default interpolate; | ||
const templateEle = document.getElementById('template') as HTMLInputElement; | ||
const dataEle = document.getElementById('data') as HTMLInputElement; | ||
const previewEle = document.getElementById('preview') as HTMLElement; | ||
|
||
function updatePreview() { | ||
const template = templateEle.value; | ||
const data = dataEle.value; | ||
try { | ||
previewEle.innerHTML = interpolate(template, JSON.parse(data)); | ||
} catch (e) { | ||
previewEle.innerHTML = `<span style="color: red;">${(e as Error).message}</span>`; | ||
} | ||
} | ||
|
||
templateEle.addEventListener('input', updatePreview); | ||
dataEle.addEventListener('input', updatePreview); | ||
|
||
templateEle.value = ` | ||
<b>DNS query: {{Question[0].name}}</b> | ||
<code>Status: {{#if TC}}TC,{{/if}}{{#if RD}}RD,{{/if}}{{#if RA}}RA,{{/if}}{{#if AD}}AD,{{/if}}{{#if CD}}CD,{{/if}}{{Status}}</code> | ||
<b>Answer</b>{{#each answer in Answer}} | ||
<code>{{answer.name}}, {{answer.type}}, (TTL: {{answer.TTL}}),{{answer.data}}</code>{{/each}} | ||
`; | ||
|
||
dataEle.value = JSON.stringify({ | ||
Status: 0, | ||
TC: false, | ||
RD: true, | ||
RA: true, | ||
AD: false, | ||
CD: false, | ||
Question: [ | ||
{ | ||
name: 'google.com', | ||
type: 1, | ||
}, | ||
], | ||
Answer: [ | ||
{ | ||
name: 'google.com', | ||
type: 1, | ||
TTL: 300, | ||
data: '172.217.24.110', | ||
}, | ||
], | ||
}, null, 2); | ||
updatePreview(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist" | ||
}, | ||
"references": [ | ||
{ "path": "../../lib/interp" }, | ||
], | ||
"include": ["src/**/*"] | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist" | ||
}, | ||
"references": [ | ||
{ "path": "../../lib/plugins" } | ||
], | ||
"include": ["src/**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
import { createShareConfig } from '../../../vite.config.shared'; | ||
import { defineConfig } from 'vite'; | ||
|
||
export default createShareConfig({ | ||
root: __dirname, | ||
nodeExternals: true, | ||
excludeMonoRepoPackages: true, | ||
export default defineConfig({ | ||
root: '.', | ||
build: { | ||
outDir: 'dist', | ||
emptyOutDir: true, | ||
rollupOptions: { | ||
input: 'index.html', | ||
output: { | ||
entryFileNames: 'index.js', | ||
chunkFileNames: '[name].js', | ||
assetFileNames: '[name].[ext]', | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"name": "@chatgpt-telegram-workers/local", | ||
"type": "module", | ||
"version": "1.10.2", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"dependencies": { | ||
"cloudflare-worker-adapter": "^1.3.3" | ||
} | ||
"name": "@chatgpt-telegram-workers/local", | ||
"type": "module", | ||
"version": "1.10.2", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"dependencies": { | ||
"cloudflare-worker-adapter": "^1.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,5 @@ | |
"references": [ | ||
{ "path": "../../lib/core" } | ||
], | ||
"include": ["src/**/*"], | ||
"include": ["src/**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.