diff --git a/.gitignore b/.gitignore index 5580a54..6f45d35 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ frontend/dist frontend/node_modules build/linux/appimage/build build/windows/nsis/MicrosoftEdgeWebview2Setup.exe +plugin/go +plugin/wails3 .DS_Store node_modules/ diff --git a/app.go b/app.go index 4f3405c..a8cdb48 100644 --- a/app.go +++ b/app.go @@ -2,6 +2,7 @@ package main import ( "go-site-clone/services" + "log" "github.com/go-rod/rod/lib/proto" "github.com/wailsapp/wails/v3/pkg/application" @@ -39,17 +40,39 @@ func (a *App) GetResources(rawURL string) *services.ResourcesList { return resources } -func (a *App) DownloadSite() { +func (a *App) DownloadSite(obj string) bool { // 将页面及资源一起返回 - // for _, v := range dataList { - // u, _ := url.Parse(v.URL) - // if v.Type == proto.NetworkResourceTypeImage && u.Hostname() == parsed.Hostname() { - // var File utils.File - // File.Download(v.URL) + log.Println(obj) + // var File utils.File + // if len(obj.CSS) > 0 { + // for k, v := range obj.CSS { + // File.Download(v) + // a.app.Event.Emit("download:css", k) // } // } - // for _, v := range RouterAll { - // var File utils.File - // File.HTMLDownload(v) + // if len(obj.Script) > 0 { + // for k, v := range obj.Script { + // File.Download(v) + // a.app.Event.Emit("download:script", k) + // } // } + // if len(obj.Image) > 0 { + // for k, v := range obj.Image { + // File.Download(v) + // a.app.Event.Emit("download:script", k) + // } + // } + // if len(obj.Video) > 0 { + // for k, v := range obj.Video { + // File.Download(v) + // a.app.Event.Emit("download:video", k) + // } + // } + // if len(obj.Dom) > 0 { + // for k, v := range obj.Dom { + // File.HTMLDownload(v) + // a.app.Event.Emit("download:dom", k) + // } + // } + return true } diff --git a/frontend/app/components/SiderMenu.vue b/frontend/app/components/SiderMenu.vue index 586d7a5..7646e2f 100644 --- a/frontend/app/components/SiderMenu.vue +++ b/frontend/app/components/SiderMenu.vue @@ -18,6 +18,16 @@ 整站下载 仿站记录 + + + + + 运行 + + + Nginx网站 + 打包应用 + @@ -31,6 +41,7 @@ import { PieChartOutlined, UserOutlined, + IeOutlined, } from '@ant-design/icons-vue'; import { ref } from 'vue'; const collapsed = ref(false); diff --git a/frontend/app/pages/site/download.vue b/frontend/app/pages/site/download.vue index c0294f6..d9980c4 100644 --- a/frontend/app/pages/site/download.vue +++ b/frontend/app/pages/site/download.vue @@ -85,7 +85,7 @@ - 用时 {{ searchTime }} 秒 + 用时 {{ searchTime }} 秒 下载 @@ -254,6 +254,11 @@ const resourceData = ref({ const isValidURL = (str) => { try { new URL(str); return true; } catch { return false; }} +// 下载当前页面资源 +const downloadResource = async ()=> { + App.DownloadSite(JSON.stringify(searchResults)) +} + // 搜索处理函数 const handleSearch = async () => { if (searchLoading.value == true) { @@ -318,6 +323,7 @@ const handleSearch = async () => { }) } + // 输入框焦点事件 const onInputFocus = () => { isInputFocused.value = true diff --git a/frontend/bindings/go-site-clone/app.js b/frontend/bindings/go-site-clone/app.js index db4616c..ac4d02b 100644 --- a/frontend/bindings/go-site-clone/app.js +++ b/frontend/bindings/go-site-clone/app.js @@ -11,10 +11,11 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr import * as services$0 from "./services/models.js"; /** - * @returns {$CancellablePromise} + * @param {string} obj + * @returns {$CancellablePromise} */ -export function DownloadSite() { - return $Call.ByID(2539977978); +export function DownloadSite(obj) { + return $Call.ByID(2539977978, obj); } /**