From f06209f8dac672bc085b87e3bbcf4f5064f2cbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E8=8B=A5=E4=B8=BA=E7=8E=8B?= Date: Mon, 2 Sep 2024 15:15:59 +0800 Subject: [PATCH] up --- src/decode.js | 4 +- src/{index.html => html.js} | 5 +- src/index.js | 128 +----------------------------------- 3 files changed, 6 insertions(+), 131 deletions(-) rename src/{index.html => html.js} (97%) diff --git a/src/decode.js b/src/decode.js index d39d9ae..6544d4f 100644 --- a/src/decode.js +++ b/src/decode.js @@ -1,5 +1,5 @@ -const md5 = require('js-md5'); -const crypto = require("crypto-js"); +import md5 from "js-md5"; +import crypto from "crypto-js"; const decrypt = function (ciphertext, iv, t) { try { const key = generateKey(t); diff --git a/src/index.html b/src/html.js similarity index 97% rename from src/index.html rename to src/html.js index 9a9d060..4f81e32 100644 --- a/src/index.html +++ b/src/html.js @@ -1,3 +1,4 @@ +export const html = ` @@ -67,7 +68,7 @@ async function checkStatus(sid) { const interval = setInterval(async () => { - const response = await fetch(`/check_status/${sid}`); + const response = await fetch("/check_status/" + sid); const data = await response.json(); if (data.status === "LoginSuccess") { clearInterval(interval); @@ -123,4 +124,4 @@ - \ No newline at end of file +` \ No newline at end of file diff --git a/src/index.js b/src/index.js index ccba5f7..645665c 100644 --- a/src/index.js +++ b/src/index.js @@ -8,133 +8,7 @@ * Learn more at https://developers.cloudflare.com/workers/ */ import { decrypt, getParams } from './decode.js'; -const html = ` - - - - - - 二维码登录 - - - - -

扫描二维码登录

-
- 二维码加载中... -
-
-
- - - -
-
- - - -
-
- -` +import {html} from './html.js'; async function handleRequest(request) { const url = new URL(request.url); if (request.method === 'POST' && url.pathname === '/generate_qr') {