Skip to content

Commit 81a589e

Browse files
committed
⚡️ 优化获取脚本逻辑 #134
1 parent 9515269 commit 81a589e

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/pages/components/ScriptMenuList/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ const ScriptMenuList: React.FC<{
204204
});
205205
}}
206206
>
207-
{isExclude(item, url.host) ? "恢复" : "排除"}
208-
{` ${url.host} 在上执行`}
207+
{isExclude(item, url.host) ? "恢复在" : "排除在"}
208+
{` ${url.host} 上执行`}
209209
</Button>
210210
)}
211211
<Popconfirm

src/pages/popup/App.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ function App() {
4545
const [version, setVersion] = useState(ExtVersion);
4646
const [currentUrl, setCurrentUrl] = useState("");
4747

48+
let url: URL | undefined;
49+
try {
50+
url = new URL(currentUrl);
51+
} catch (e) {
52+
// ignore error
53+
}
54+
4855
const message = IoC.instance(MessageInternal) as MessageInternal;
4956
useEffect(() => {
5057
systemManage.getNotice().then((res) => {
@@ -142,7 +149,11 @@ function App() {
142149
<IconPlus style={iconStyle} />
143150
新建脚本
144151
</Menu.Item>
145-
<Menu.Item key="https://scriptcat.org/">
152+
<Menu.Item
153+
key={`https://scriptcat.org/search?domain=${
154+
url && url.host
155+
}`}
156+
>
146157
<IconSearch style={iconStyle} />
147158
获取脚本
148159
</Menu.Item>

0 commit comments

Comments
 (0)