Skip to content

Commit

Permalink
perf: add a toast tip that the site must use https
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Dec 4, 2022
1 parent 96154fe commit b9620d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions console/src/views/MigrateView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ async function handleOpenFile() {
return;
}
const { protocol, hostname } = location;
// https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
if (!["localhost", "127.0.0.1"].includes(hostname) && protocol === "http:") {
Toast.warning("当前无法选择文件,站点必须使用 HTTPS 协议");
return;
}
await res.open();
if (!res.data.value) {
Expand Down
Loading

0 comments on commit b9620d4

Please sign in to comment.