傅豪杰 2 years ago
parent
commit
df8dfe8932
7 changed files with 3817 additions and 46 deletions
  1. 344 0
      .gitignore
  2. 22 14
      main.js
  3. 3384 0
      package-lock.json
  4. 3 2
      package.json
  5. 24 10
      preload.js
  6. 10 0
      utils/index.js
  7. 30 20
      view/index/index.js

+ 344 - 0
.gitignore

@@ -0,0 +1,344 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+*.vcxproj.filters
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project‘s static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+**/Properties/launchSettings.json
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.psd
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3‘s project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/
+*.sql
+*.sql
+docker
+App_Data
+publishTo
+UploadFiles
+ProxyContextTemp
+/src/Customer/Ricent.Saas.Web/RedisTemp
+.hbuilderx/launch.json
+unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/common/runtime.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-badge/demo.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-badge/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-btn/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-checkbox/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-checkbox-group/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-icon/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-search/demo.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-search/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-tab/demo.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-tab/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-tag/demo.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/components/ysn-tag/index.js.map
+unpackage/dist/dev/.sourcemap/mp-weixin/pages/Business/BusinessManage/index.js.map
+unpackage/dist/dev/mp-weixin/common/main.js
+unpackage/dist/dev/mp-weixin/common/runtime.js
+unpackage/dist/dev/mp-weixin/common/vendor.js
+unpackage/dist/dev/mp-weixin/components/ysn-badge/demo.js
+unpackage/dist/dev/mp-weixin/components/ysn-badge/demo.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-badge/demo.wxss
+unpackage/dist/dev/mp-weixin/components/ysn-badge/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-badge/index.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-btn/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-btn/index.wxss
+unpackage/dist/dev/mp-weixin/components/ysn-checkbox/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-checkbox/index.wxss
+unpackage/dist/dev/mp-weixin/components/ysn-checkbox-group/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-checkbox-group/index.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-icon/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-icon/index.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-icon/index.wxss
+unpackage/dist/dev/mp-weixin/components/ysn-search/demo.js
+unpackage/dist/dev/mp-weixin/components/ysn-search/demo.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-search/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-search/index.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-search/index.wxss
+unpackage/dist/dev/mp-weixin/components/ysn-tab/demo.js
+unpackage/dist/dev/mp-weixin/components/ysn-tab/demo.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-tab/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-tab/index.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-tag/demo.js
+unpackage/dist/dev/mp-weixin/components/ysn-tag/demo.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-tag/demo.wxss
+unpackage/dist/dev/mp-weixin/components/ysn-tag/index.js
+unpackage/dist/dev/mp-weixin/components/ysn-tag/index.wxml
+unpackage/dist/dev/mp-weixin/components/ysn-tag/index.wxss
+unpackage/dist/dev/mp-weixin/pages/Business/BusinessManage/index.js
+unpackage/dist/dev/mp-weixin/pages/Business/BusinessManage/index.json
+unpackage/dist/dev/mp-weixin/pages/Business/BusinessManage/index.wxml
+unpackage/dist/dev/mp-weixin/pages/Business/BusinessManage/index.wxss
+
+
+dist
+node_modules
+src/pages.json
+.vscode/settings.json
+.DS_Store

+ 22 - 14
main.js

@@ -1,9 +1,18 @@
+/*
+ * @Author: fhj
+ * @LastEditors: fhj
+ * @Description: 
+ */
 const { app, BrowserWindow, Menu } = require('electron')
 const path = require('path')
+const utils = require('./utils');
+
+
+
 
 //热加载
-const reloader = require('electron-reloader')
-reloader(module)
+// const reloader = require('electron-reloader')
+// reloader(module)
 
 /**
  * 在 Electron 中,只有在 app 模块的 ready 事件被激发后才能创建浏览器窗口。 
@@ -11,7 +20,7 @@ reloader(module)
  */
 app.whenReady().then(() => {
     createWindow()
-    convertVodie()
+    // convertVodie()
 })
 
 /**
@@ -22,7 +31,6 @@ app.on('window-all-closed', () => {
         app.quit()
     }
 })
-
 const createWindow = () => {
     const win = new BrowserWindow({
       width: 800,
@@ -31,21 +39,21 @@ const createWindow = () => {
         preload: path.join(__dirname, 'preload.js'),
         //允许运行子线程
         nodeIntegrationInWorker: true,
-        //开启node支持
+        // //开启node支持
         nodeIntegration: true,
         enableRemoteModule: true,
-        //关闭安全性验证
-        contextIsolation: false,
-        //允许跨域
-        webSecurity: false
+        // //关闭安全性验证
+        // contextIsolation: false,
+        // //允许跨域
+        // webSecurity: false
       }
     })
 
-    app.on('activate', () => {
-        if (BrowserWindow.getAllWindows().length === 0) {
-            createWindow()
-        }
-    })
+       app.on('activate', () => {
+            if (BrowserWindow.getAllWindows().length === 0) {
+                createWindow();
+            }
+        });
 
     win.webContents.openDevTools();
 

File diff suppressed because it is too large
+ 3384 - 0
package-lock.json


+ 3 - 2
package.json

@@ -18,8 +18,9 @@
     "ffprobe-static": "^3.1.0",
     "fluent-ffmpeg": "^2.1.2",
     "fs": "^0.0.1-security",
-    "http": "^0.0.1-security",
-    "https": "^1.0.0"
+    "http": "0.0.1-security",
+    "https": "^1.0.0",
+    "url": "^0.11.0"
   },
   "author": "Andy Han",
   "devDependencies": {

+ 24 - 10
preload.js

@@ -1,10 +1,24 @@
-window.addEventListener('DOMContentLoaded', () => {
-    const replaceText = (selector, text) => {
-        const element = document.getElementById(selector)
-        if (element) element.innerText = text
-    }
-
-    for (const dependency of ['chrome', 'node', 'electron']) {
-        replaceText(`${dependency}-version`, process.versions[dependency])
-    }
-})
+/*
+ * @Author: fhj
+ * @LastEditors: fhj
+ * @Description: 
+ */
+// window.addEventListener('DOMContentLoaded', () => {
+//     const replaceText = (selector, text) => {
+//         const element = document.getElementById(selector)
+//         if (element) element.innerText = text
+//     }
+
+//     for (const dependency of ['chrome', 'node', 'electron']) {
+//         replaceText(`${dependency}-version`, process.versions[dependency])
+//     }
+// })
+
+const {get,post} = require('./utils/index')
+
+const { contextBridge } = require('electron');
+
+contextBridge.exposeInMainWorld('nodeRequest', {
+  get,
+  post
+});

+ 10 - 0
utils/index.js

@@ -0,0 +1,10 @@
+/*
+ * @Author: fhj
+ * @LastEditors: fhj
+ * @Description: 
+ */
+
+const axios = require('axios').default;
+
+
+module.exports  = axios

+ 30 - 20
view/index/index.js

@@ -1,29 +1,39 @@
-const {  BrowserWindow, dialog, shell } = require('electron')
-const cheerio = require('cheerio')
-const pathToFfmpeg = require('ffmpeg-static')
-const {path} = require('ffprobe-static')
-const Ffmpeg = require('fluent-ffmpeg')
-const axios = require('axios')
-axios.defaults.adapter = require("axios/lib/adapters/http");
-ffmpeg = new Ffmpeg()
+/*
+ * @Author: fhj
+ * @LastEditors: fhj
+ * @Description: 
+ */
+// const {  BrowserWindow, dialog, shell } = require('electron')
+// const cheerio = require('cheerio')
+// const pathToFfmpeg = require('ffmpeg-static')
+// const {path} = require('ffprobe-static')
+// const Ffmpeg = require('fluent-ffmpeg')
+// // axios.defaults.adapter = require("axios/lib/adapters/http");
+// ffmpeg = new Ffmpeg()
 
 const ckBtn = document.getElementById('ck')
-ckBtn.onclick = function (e) {
-    console.log(pathToFfmpeg)
-    var source = '/Users/Andy/Documents/work/tickTock/TikTokDownload/Download/post/Milo大人/2022-10-10 15.06.20广东有了秋天的感觉#生活碎片_#秋天_#粤语_#风里有了秋的味道.mp4';
-    ffmpeg.setFfmpegPath(pathToFfmpeg).addInput(source)
-    .output('output/output.flv')
-    .on('end', function () {
-        console.log('Finished processing');
+ckBtn.onclick = async  function (e) {
+    let getRes = await nodeRequest.get('https://www.baidu.com')
+    console.log(getRes)
+    let postRes = await nodeRequest.post({
+        data:{},
+        url:''
     })
-    .run();
+    console.log(postRes)
+    // console.log(pathToFfmpeg)
+    // var source = '/Users/Andy/Documents/work/tickTock/TikTokDownload/Download/post/Milo大人/2022-10-10 15.06.20广东有了秋天的感觉#生活碎片_#秋天_#粤语_#风里有了秋的味道.mp4';
+    // ffmpeg.setFfmpegPath(pathToFfmpeg).addInput(source)
+    // .output('output/output.flv')
+    // .on('end', function () {
+    //     console.log('Finished processing');
+    // })
+    // .run();
 }
 
 const dyGetBtn = document.getElementById('dyGet')
-dyGetBtn.onclick = function (e) {
-    console.log(111)
-    let result = axiosGet('https://v.douyin.com/efrHYf2/')
-    // console.log(result);
+dyGetBtn.onclick =  async function (e) {
+    let result = await axiosGet('https://v.douyin.com/efrHYf2/')
+    console.log(result);
 }