From 3d058066b93d8a1c2596bd6151b723d33494302b Mon Sep 17 00:00:00 2001 From: nite07 Date: Wed, 13 Mar 2024 16:57:32 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E8=A1=A5=E5=85=A8=E7=9F=AD=E9=93=BE?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/static/index.html | 1 - api/static/index.js | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/api/static/index.html b/api/static/index.html index 27d6d65..eddd8b7 100644 --- a/api/static/index.html +++ b/api/static/index.html @@ -47,7 +47,6 @@
- diff --git a/api/static/index.js b/api/static/index.js index baa28ea..ee5d022 100644 --- a/api/static/index.js +++ b/api/static/index.js @@ -157,10 +157,8 @@ function generateURI() { async function parseInputURL() { // 获取输入框中的 URL const inputURL = document.getElementById("urlInput").value; - const urlshortLinkPasswdInput = document.getElementById( - "urlshortLinkPasswdInput" - ).value; - + // 清除现有的输入框值 + clearExistingValues(); if (!inputURL) { alert("请输入有效的链接!"); return; @@ -176,19 +174,20 @@ async function parseInputURL() { if (url.pathname.includes("/s/")) { let hash = url.pathname.substring(url.pathname.lastIndexOf("/s/") + 3); let q = new URLSearchParams(); + let password = url.searchParams.get("password"); q.append("hash", hash); - q.append("password", urlshortLinkPasswdInput); + q.append("password", password); try { const response = await axios.get("./short?" + q.toString()); url = new URL(window.location.href + response.data); + document.querySelector("#apiShortLink").value = inputURL; + document.querySelector("#password").value = password; } catch (error) { console.log(error); alert("获取短链失败,请检查密码!"); } } let params = new URLSearchParams(url.search); - // 清除现有的输入框值 - clearExistingValues(); // 分配值到对应的输入框 const pathSections = url.pathname.split("/");