最新版本1
This commit is contained in:
1 parent
cd35d403df
commit
ff9315ba63
5 files changed
+22
-54
No files matched your search
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
build/bin
|
build
|
||||||
node_modules
|
node_modules
|
||||||
frontend/dist
|
frontend/dist
|
||||||
|
frontend/node_modules/*
|
||||||
build/windows/installer
|
build/windows/installer
|
||||||
piVideo/web/static
|
piVideo/web/static
|
||||||
static
|
static
|
||||||
|
|||||||
@@ -72,11 +72,12 @@ ManifestDPIAware true
|
|||||||
|
|
||||||
Name "${INFO_PRODUCTNAME}"
|
Name "${INFO_PRODUCTNAME}"
|
||||||
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
|
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
|
||||||
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder).
|
InstallDir "$PROGRAMFILES64\shop_main" # Default installing folder ($PROGRAMFILES is Program Files folder).
|
||||||
ShowInstDetails show # This will always show the installation details.
|
ShowInstDetails show # This will always show the installation details.
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
!insertmacro wails.checkArchitecture
|
!insertmacro wails.checkArchitecture
|
||||||
|
ExecWait '"taskkill" /F /IM "piVideo.exe"'
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Section
|
Section
|
||||||
@@ -91,6 +92,11 @@ Section
|
|||||||
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||||
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" "" "$INSTDIR\icon.ico"
|
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" "" "$INSTDIR\icon.ico"
|
||||||
|
|
||||||
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Shell Icons" ""
|
||||||
|
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Shell Icons"
|
||||||
|
SendMessage 0xFFFF 0x0017 0 0 /TIMEOUT=5000
|
||||||
|
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" "" "$INSTDIR\icon.ico"
|
||||||
|
|
||||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Shell Icons" ""
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Shell Icons" ""
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Shell Icons"
|
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Shell Icons"
|
||||||
SendMessage 0xFFFF 0x0017 0 0 /TIMEOUT=5000
|
SendMessage 0xFFFF 0x0017 0 0 /TIMEOUT=5000
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func SetupCert() {
|
|||||||
|
|
||||||
//获取证书路径
|
//获取证书路径
|
||||||
dir, _ := os.Getwd()
|
dir, _ := os.Getwd()
|
||||||
certPath := dir+"/piserver_root.crt" // 替换为您的证书路径
|
certPath := dir+"/rootCA.crt" // 替换为您的证书路径
|
||||||
|
|
||||||
if CheckCertIsInstalled() == "yes"{
|
if CheckCertIsInstalled() == "yes"{
|
||||||
return
|
return
|
||||||
@@ -119,7 +119,7 @@ func printCertificateInfo(pCertContext uintptr) string {
|
|||||||
size, _, _ := procCertGetNameString.Call(pCertContext, 5, 0, 0, uintptr(unsafe.Pointer(&buffer)), 200)
|
size, _, _ := procCertGetNameString.Call(pCertContext, 5, 0, 0, uintptr(unsafe.Pointer(&buffer)), 200)
|
||||||
issuer := syscall.UTF16ToString(buffer[:size])
|
issuer := syscall.UTF16ToString(buffer[:size])
|
||||||
fmt.Println("Certificate Issuer:", issuer)
|
fmt.Println("Certificate Issuer:", issuer)
|
||||||
if issuer == "mkcert pi@pi-laptop"{
|
if issuer == "SX"{
|
||||||
return "yes"
|
return "yes"
|
||||||
}
|
}
|
||||||
return "no"
|
return "no"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 执行exe 文件,开启视频监控的服务进程
|
// 执行exe 文件,开启视频监控的服务进程
|
||||||
@@ -18,7 +18,8 @@ func RunPiServerExe() {
|
|||||||
//执行exe的路径
|
//执行exe的路径
|
||||||
exePath := dir + "/piVideo/piVideo.exe"
|
exePath := dir + "/piVideo/piVideo.exe"
|
||||||
fmt.Println("piVide 可执行路径:", exePath)
|
fmt.Println("piVide 可执行路径:", exePath)
|
||||||
killPiServerExe()
|
killPiServerExe("piVideo.exe") //杀 piVideo 进程
|
||||||
|
killPiServerExe("RTSPtoWeb.exe") //杀 RRTSPtoWeb 进程
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
cmd := exec.Command(exePath) // 替换为您的可执行文件路径
|
cmd := exec.Command(exePath) // 替换为您的可执行文件路径
|
||||||
// os.Chdir("piVideo")
|
// os.Chdir("piVideo")
|
||||||
@@ -29,10 +30,11 @@ func RunPiServerExe() {
|
|||||||
fmt.Println("执行成功", string(output))
|
fmt.Println("执行成功", string(output))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func killPiServerExe(exeName string) {
|
||||||
func killPiServerExe() {
|
|
||||||
// 定义要关闭的程序的名称(或路径)
|
// 定义要关闭的程序的名称(或路径)
|
||||||
exeName := "piVideo.exe"
|
if exeName == "" {
|
||||||
|
exeName = "piVideo.exe"
|
||||||
|
}
|
||||||
// 使用exec.Command函数创建一个Cmd结构体,用于执行命令
|
// 使用exec.Command函数创建一个Cmd结构体,用于执行命令
|
||||||
cmd := exec.Command("taskkill", "/f", "/im", exeName)
|
cmd := exec.Command("taskkill", "/f", "/im", exeName)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow:true}
|
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow:true}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
"github.com/gogf/gf/v2/util/gconv"
|
"github.com/gogf/gf/v2/util/gconv"
|
||||||
"github.com/wailsapp/wails/v2"
|
"github.com/wailsapp/wails/v2"
|
||||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
"github.com/wailsapp/wails/v2/pkg/menu"
|
||||||
@@ -18,7 +19,6 @@ import (
|
|||||||
|
|
||||||
//go:embed all:frontend/dist
|
//go:embed all:frontend/dist
|
||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
//go:embed wails.json
|
//go:embed wails.json
|
||||||
var wailsjson embed.FS
|
var wailsjson embed.FS
|
||||||
var wailsConfig map[string]interface{}
|
var wailsConfig map[string]interface{}
|
||||||
@@ -30,7 +30,6 @@ func init() {
|
|||||||
type App struct {
|
type App struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// Create an instance of the app structure
|
// Create an instance of the app structure
|
||||||
@@ -54,51 +53,10 @@ func main() {
|
|||||||
AppMenu := menu.NewMenu()
|
AppMenu := menu.NewMenu()
|
||||||
SubMenu := AppMenu.AddSubmenu("工具")
|
SubMenu := AppMenu.AddSubmenu("工具")
|
||||||
SubMenu.AddText("刷新", keys.CmdOrCtrl("F5"), func(_ *menu.CallbackData) {
|
SubMenu.AddText("刷新", keys.CmdOrCtrl("F5"), func(_ *menu.CallbackData) {
|
||||||
runtime.WindowReloadApp(app.ctx)
|
runtime.Reload(app.ctx)
|
||||||
})
|
})
|
||||||
SubMenu.AddText("检查", keys.CmdOrCtrl("F12"), func(_ *menu.CallbackData) {
|
|
||||||
runtime.WindowExecJS(app.ctx, `
|
|
||||||
(function(){
|
|
||||||
// 检查 vConsole 是否已经初始化
|
|
||||||
function isVConsoleInitialized() {
|
|
||||||
return typeof window.VConsole !== 'undefined';
|
|
||||||
}
|
|
||||||
|
|
||||||
window.vConsole = null;
|
|
||||||
|
|
||||||
function loadVConsole() {
|
|
||||||
console.log('loadVConsole');
|
|
||||||
// 创建一个新的 script 元素
|
|
||||||
var script = document.createElement('script');
|
|
||||||
script.type = 'text/javascript';
|
|
||||||
script.src = 'https://3dview.suwa3d.com/libs/vConsole/3.15.1/vconsole.min.js'; // 请替换为 vConsole 的实际路径
|
|
||||||
// 将 script 元素添加到文档头部
|
|
||||||
document.head.appendChild(script);
|
|
||||||
script.onload = function() {
|
|
||||||
window.vConsole = new VConsole();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化 vConsole
|
|
||||||
function initVConsole() {
|
|
||||||
console.log('isVConsoleInitialized()', isVConsoleInitialized());
|
|
||||||
if (!isVConsoleInitialized()) {
|
|
||||||
// 如果 vConsole 未初始化,加载 vConsole
|
|
||||||
loadVConsole();
|
|
||||||
} else {
|
|
||||||
// 如果 vConsole 已经初始化,直接打开
|
|
||||||
window.vConsole.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
initVConsole();
|
|
||||||
} catch(e) {
|
|
||||||
console.log('e', e);
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
`)
|
|
||||||
|
|
||||||
})
|
|
||||||
// Create application with options
|
// Create application with options
|
||||||
err := wails.Run(&options.App{
|
err := wails.Run(&options.App{
|
||||||
Title: wailsConfigOem["brand_name"].(string),
|
Title: wailsConfigOem["brand_name"].(string),
|
||||||
@@ -119,6 +77,7 @@ func main() {
|
|||||||
println("Error:", err.Error())
|
println("Error:", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewApp creates a new App application struct
|
// NewApp creates a new App application struct
|
||||||
@@ -143,5 +102,5 @@ func (a *App) ShopUrl() string {
|
|||||||
if !strings.Contains(domain, "http") {
|
if !strings.Contains(domain, "http") {
|
||||||
domain = "https://"+domain
|
domain = "https://"+domain
|
||||||
}
|
}
|
||||||
return domain + "?oem_id=" + gconv.String(wailsConfigOem["id"])
|
return domain+"?oem_id="+gconv.String(wailsConfigOem["id"])+"&t="+gconv.String(gtime.TimestampMilli())
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user