修改下载渲染

This commit is contained in:
zyj
2025-10-24 18:26:28 +08:00
parent 838e2cb037
commit a1a002370b
5 changed files with 56 additions and 13 deletions

2
.gitignore vendored
View File

@@ -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/

41
app.go
View File

@@ -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
}

View File

@@ -18,6 +18,16 @@
<a-menu-item key="download">整站下载</a-menu-item>
<a-menu-item key="record">仿站记录</a-menu-item>
</a-sub-menu>
<a-sub-menu key="run">
<template #title>
<span>
<IeOutlined />
<span>运行</span>
</span>
</template>
<a-menu-item key="webpage">Nginx网站</a-menu-item>
<a-menu-item key="pack">打包应用</a-menu-item>
</a-sub-menu>
</a-menu>
</a-layout-sider>
</div>
@@ -31,6 +41,7 @@
import {
PieChartOutlined,
UserOutlined,
IeOutlined,
} from '@ant-design/icons-vue';
import { ref } from 'vue';
const collapsed = ref<boolean>(false);

View File

@@ -85,7 +85,7 @@
<!-- 结果统计和筛选 -->
<div class="results-meta">
<div class="meta-info">
用时 {{ searchTime }}
用时 {{ searchTime }} <a-button @click="downloadResource">下载</a-button>
</div>
<div class="filter-options">
<a-radio-group v-model:value="filterType" size="small">
@@ -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

View File

@@ -11,10 +11,11 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr
import * as services$0 from "./services/models.js";
/**
* @returns {$CancellablePromise<void>}
* @param {string} obj
* @returns {$CancellablePromise<boolean>}
*/
export function DownloadSite() {
return $Call.ByID(2539977978);
export function DownloadSite(obj) {
return $Call.ByID(2539977978, obj);
}
/**