├── img1.jpg ├── frontend ├── src │ ├── index.css │ ├── assets │ │ ├── images │ │ │ └── background-image.png │ │ ├── fonts │ │ │ ├── nunito-v16-latin-regular.woff2 │ │ │ └── OFL.txt │ │ └── icons │ │ │ ├── loading.svg │ │ │ ├── power.svg │ │ │ ├── folder.svg │ │ │ ├── file.svg │ │ │ ├── setting-config.svg │ │ │ ├── file-minus.svg │ │ │ ├── folder-check.svg │ │ │ ├── folder-medical.svg │ │ │ ├── file-medical.svg │ │ │ ├── file-check.svg │ │ │ ├── file-alt.svg │ │ │ ├── file-minus-alt.svg │ │ │ ├── file-question.svg │ │ │ ├── file-plus-alt.svg │ │ │ ├── file-check-alt.svg │ │ │ ├── bright.svg │ │ │ ├── file-edit-alt.svg │ │ │ ├── file-times-alt.svg │ │ │ ├── file-exclamation.svg │ │ │ ├── folder-exclamation.svg │ │ │ └── file-question-alt.svg │ ├── main.js │ ├── animation.less │ ├── style.css │ ├── components │ │ ├── SvgIcon.vue │ │ ├── Options.vue │ │ └── Upload.vue │ └── App.vue ├── wailsjs │ ├── index.js │ ├── go │ │ ├── main │ │ │ ├── App.d.ts │ │ │ └── App.js │ │ └── models.ts │ └── runtime │ │ ├── package.json │ │ ├── runtime.js │ │ └── runtime.d.ts ├── README.md ├── postcss.config.js ├── tailwind.config.js ├── .gitignore ├── index.html ├── vite.config.js └── package.json ├── .gitignore ├── README.md ├── wails.json ├── main.go ├── go.mod ├── charset └── charset.go ├── options.go ├── app.go └── go.sum /img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lnncoco/wails-data-filter/HEAD/img1.jpg -------------------------------------------------------------------------------- /frontend/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /frontend/wailsjs/index.js: -------------------------------------------------------------------------------- 1 | export * from "./go/main/App"; 2 | export * from "./runtime/runtime"; 3 | -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | 数据过滤工具前端部分。 4 | 5 | 基于: 6 | 7 | - Vue3 + Vite 8 | - Tailwind + Less 9 | -------------------------------------------------------------------------------- /frontend/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # system ignore 2 | .DS_Store 3 | Thumbs.db 4 | 5 | # ide 6 | .idea/ 7 | 8 | # project 9 | build/bin 10 | options.json 11 | -------------------------------------------------------------------------------- /frontend/src/assets/images/background-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lnncoco/wails-data-filter/HEAD/frontend/src/assets/images/background-image.png -------------------------------------------------------------------------------- /frontend/src/assets/fonts/nunito-v16-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lnncoco/wails-data-filter/HEAD/frontend/src/assets/fonts/nunito-v16-latin-regular.woff2 -------------------------------------------------------------------------------- /frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import App from "./App.vue"; 3 | import "virtual:svg-icons-register"; 4 | import svgIcon from "./components/SvgIcon.vue"; 5 | import "./index.css"; 6 | 7 | createApp(App).component("svg-icon", svgIcon).mount("#app"); 8 | -------------------------------------------------------------------------------- /frontend/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"], 4 | theme: { 5 | extend: {}, 6 | theme: {}, 7 | }, 8 | plugins: [require("daisyui")], 9 | }; 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | 基于 Wails2 的数据过滤工具,用来替换或删除文本数据指定字符工具。 4 | 5 | 前端实现:Vue3 + Vite + Tailwind + Less 6 | 7 | ![image](./img1.jpg) 8 | 9 | 10 | ## 开发 11 | 12 | 调试 13 | 14 | ``` 15 | wails dev 16 | ``` 17 | 18 | 执行编译 19 | 20 | ``` 21 | wails build -webview2 Embed 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # system ignore 9 | .DS_Store 10 | Thumbs.db 11 | 12 | # ide 13 | .idea/ 14 | 15 | # project 16 | dist/* 17 | !dist/.gitkeep 18 | node_modules 19 | package-lock.json 20 | package.json.md5 21 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/loading.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wails.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wails-data-filter", 3 | "outputfilename": "wails-data-filter", 4 | "frontend:install": "npm install", 5 | "frontend:build": "npm run build", 6 | "frontend:dev:watcher": "npm run dev", 7 | "frontend:dev:serverUrl": "auto", 8 | "author": { 9 | "name": "lnncoco", 10 | "email": "lnncoco@foxmail.com" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wails-data-filter 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /frontend/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import vue from "@vitejs/plugin-vue"; 3 | import { createSvgIconsPlugin } from "vite-plugin-svg-icons"; 4 | import path from "path"; 5 | 6 | // https://vitejs.dev/config/ 7 | export default defineConfig({ 8 | plugins: [ 9 | vue(), 10 | createSvgIconsPlugin({ 11 | iconDirs: [path.resolve(process.cwd(), "src/assets/icons")], 12 | symbolId: "icon-[dir]-[name]", 13 | }), 14 | ], 15 | }); 16 | -------------------------------------------------------------------------------- /frontend/src/animation.less: -------------------------------------------------------------------------------- 1 | @keyframes text-focus-in { 2 | 0% { 3 | filter: blur(12px); 4 | opacity: 0; 5 | } 6 | 100% { 7 | filter: blur(0px); 8 | opacity: 1; 9 | } 10 | } 11 | .text-focus-in { 12 | animation: text-focus-in 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) both; 13 | } 14 | 15 | @keyframes rotate { 16 | 0% { 17 | transform: rotate(0deg); 18 | } 19 | 100% { 20 | transform: rotate(360deg); 21 | } 22 | } 23 | .ele-rotate360 { 24 | animation: rotate 1s linear infinite; 25 | } -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "daisyui": "^2.24.0", 12 | "vue": "^3.2.25" 13 | }, 14 | "devDependencies": { 15 | "@vitejs/plugin-vue": "^2.3.3", 16 | "autoprefixer": "^10.4.8", 17 | "less": "^4.1.3", 18 | "postcss": "^8.4.16", 19 | "tailwindcss": "^3.1.8", 20 | "vite": "^2.9.9", 21 | "vite-plugin-svg-icons": "^2.0.1" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /frontend/wailsjs/go/main/App.d.ts: -------------------------------------------------------------------------------- 1 | // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL 2 | // This file is automatically generated. DO NOT EDIT 3 | import {main} from '../models'; 4 | 5 | export function FilterFile(arg1:string):Promise; 6 | 7 | export function GetOptions():Promise; 8 | 9 | export function Greet(arg1:string):Promise; 10 | 11 | export function SelectFile(arg1:string,arg2:string):Promise; 12 | 13 | export function SetOptions(arg1:main.Options):void; 14 | 15 | export function SplitFilePath(arg1:string):Promise; 16 | -------------------------------------------------------------------------------- /frontend/src/style.css: -------------------------------------------------------------------------------- 1 | html { 2 | background-color: transparent; 3 | text-align: center; 4 | } 5 | 6 | body { 7 | margin: 0; 8 | color: #666; 9 | font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", 10 | "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 11 | sans-serif; 12 | } 13 | 14 | @font-face { 15 | font-family: "Nunito"; 16 | font-style: normal; 17 | font-weight: 400; 18 | src: local(""), 19 | url("assets/fonts/nunito-v16-latin-regular.woff2") format("woff2"); 20 | } 21 | 22 | #app { 23 | height: 100vh; 24 | text-align: center; 25 | } 26 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/power.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/wailsjs/runtime/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@wailsapp/runtime", 3 | "version": "2.0.0", 4 | "description": "Wails Javascript runtime library", 5 | "main": "runtime.js", 6 | "types": "runtime.d.ts", 7 | "scripts": { 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/wailsapp/wails.git" 12 | }, 13 | "keywords": [ 14 | "Wails", 15 | "Javascript", 16 | "Go" 17 | ], 18 | "author": "Lea Anthony ", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/wailsapp/wails/issues" 22 | }, 23 | "homepage": "https://github.com/wailsapp/wails#readme" 24 | } 25 | -------------------------------------------------------------------------------- /frontend/src/components/SvgIcon.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 35 | -------------------------------------------------------------------------------- /frontend/wailsjs/go/main/App.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL 3 | // This file is automatically generated. DO NOT EDIT 4 | 5 | export function FilterFile(arg1) { 6 | return window['go']['main']['App']['FilterFile'](arg1); 7 | } 8 | 9 | export function GetOptions() { 10 | return window['go']['main']['App']['GetOptions'](); 11 | } 12 | 13 | export function Greet(arg1) { 14 | return window['go']['main']['App']['Greet'](arg1); 15 | } 16 | 17 | export function SelectFile(arg1, arg2) { 18 | return window['go']['main']['App']['SelectFile'](arg1, arg2); 19 | } 20 | 21 | export function SetOptions(arg1) { 22 | return window['go']['main']['App']['SetOptions'](arg1); 23 | } 24 | 25 | export function SplitFilePath(arg1) { 26 | return window['go']['main']['App']['SplitFilePath'](arg1); 27 | } 28 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | 6 | "github.com/wailsapp/wails/v2" 7 | "github.com/wailsapp/wails/v2/pkg/options" 8 | ) 9 | 10 | //go:embed frontend/dist 11 | var assets embed.FS 12 | 13 | func main() { 14 | // Create an instance of the app structure 15 | app := NewApp() 16 | 17 | // Create application with options 18 | err := wails.Run(&options.App{ 19 | Title: "数据过滤工具", 20 | Width: 640, 21 | Height: 480, 22 | Assets: assets, 23 | BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1}, 24 | OnStartup: app.startup, 25 | Frameless: true, 26 | DisableResize: true, 27 | //AlwaysOnTop: true, 28 | Bind: []interface{}{ 29 | app, 30 | }, 31 | }) 32 | 33 | if err != nil { 34 | println("Error:", err.Error()) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/setting-config.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-minus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/folder-check.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/folder-medical.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-medical.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-check.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/App.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 41 | 42 | 47 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module datafilter 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/wailsapp/wails/v2 v2.0.0-beta.44.2 7 | golang.org/x/text v0.3.7 8 | ) 9 | 10 | require ( 11 | github.com/bep/debounce v1.2.1 // indirect 12 | github.com/go-ole/go-ole v1.2.6 // indirect 13 | github.com/google/uuid v1.1.2 // indirect 14 | github.com/imdario/mergo v0.3.12 // indirect 15 | github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect 16 | github.com/labstack/echo/v4 v4.7.2 // indirect 17 | github.com/labstack/gommon v0.3.1 // indirect 18 | github.com/leaanthony/go-ansi-parser v1.0.1 // indirect 19 | github.com/leaanthony/gosod v1.0.3 // indirect 20 | github.com/leaanthony/slicer v1.5.0 // indirect 21 | github.com/mattn/go-colorable v0.1.11 // indirect 22 | github.com/mattn/go-isatty v0.0.14 // indirect 23 | github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect 24 | github.com/pkg/errors v0.9.1 // indirect 25 | github.com/tkrajina/go-reflector v0.5.5 // indirect 26 | github.com/valyala/bytebufferpool v1.0.0 // indirect 27 | github.com/valyala/fasttemplate v1.2.1 // indirect 28 | github.com/wailsapp/mimetype v1.4.1 // indirect 29 | golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect 30 | golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect 31 | golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect 32 | ) 33 | 34 | // replace github.com/wailsapp/wails/v2 v2.0.0-beta.43 => C:\Users\dataexa\go\pkg\mod\github.com\wailsapp\wails\v2@v2.0.0-beta.43 35 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-minus-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-question.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-plus-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-check-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/bright.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-edit-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-times-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-exclamation.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/folder-exclamation.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/icons/file-question-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/wailsjs/go/models.ts: -------------------------------------------------------------------------------- 1 | export namespace main { 2 | 3 | export class RegexConfig { 4 | regexp: string; 5 | value: string; 6 | 7 | static createFrom(source: any = {}) { 8 | return new RegexConfig(source); 9 | } 10 | 11 | constructor(source: any = {}) { 12 | if ('string' === typeof source) source = JSON.parse(source); 13 | this.regexp = source["regexp"]; 14 | this.value = source["value"]; 15 | } 16 | } 17 | export class Options { 18 | eraseZeroWidthCharacter: boolean; 19 | regex: RegexConfig[]; 20 | 21 | static createFrom(source: any = {}) { 22 | return new Options(source); 23 | } 24 | 25 | constructor(source: any = {}) { 26 | if ('string' === typeof source) source = JSON.parse(source); 27 | this.eraseZeroWidthCharacter = source["eraseZeroWidthCharacter"]; 28 | this.regex = this.convertValues(source["regex"], RegexConfig); 29 | } 30 | 31 | convertValues(a: any, classs: any, asMap: boolean = false): any { 32 | if (!a) { 33 | return a; 34 | } 35 | if (a.slice) { 36 | return (a as any[]).map(elem => this.convertValues(elem, classs)); 37 | } else if ("object" === typeof a) { 38 | if (asMap) { 39 | for (const key of Object.keys(a)) { 40 | a[key] = new classs(a[key]); 41 | } 42 | return a; 43 | } 44 | return new classs(a); 45 | } 46 | return a; 47 | } 48 | } 49 | export class PathStruct { 50 | directory: string; 51 | filename: string; 52 | ext: string; 53 | addSuffixStr: string; 54 | 55 | static createFrom(source: any = {}) { 56 | return new PathStruct(source); 57 | } 58 | 59 | constructor(source: any = {}) { 60 | if ('string' === typeof source) source = JSON.parse(source); 61 | this.directory = source["directory"]; 62 | this.filename = source["filename"]; 63 | this.ext = source["ext"]; 64 | this.addSuffixStr = source["addSuffixStr"]; 65 | } 66 | } 67 | 68 | } 69 | 70 | -------------------------------------------------------------------------------- /charset/charset.go: -------------------------------------------------------------------------------- 1 | package charset 2 | 3 | import ( 4 | "bytes" 5 | "errors" 6 | "fmt" 7 | "io/ioutil" 8 | "unicode/utf8" 9 | 10 | "golang.org/x/text/encoding" 11 | "golang.org/x/text/encoding/ianaindex" 12 | "golang.org/x/text/transform" 13 | ) 14 | 15 | type Charset string 16 | 17 | // 中文 18 | const ( 19 | GBK Charset = "GBK" 20 | GB18030 = "GB18030" 21 | GB2312 = "GB2312" 22 | Big5 = "Big5" 23 | ) 24 | 25 | // 日文 26 | const ( 27 | EUCJP Charset = "EUCJP" 28 | ISO2022JP = "ISO2022JP" 29 | ShiftJIS = "ShiftJIS" 30 | ) 31 | 32 | // 韩文 33 | const ( 34 | EUCKR Charset = "EUCKR" 35 | ) 36 | 37 | // Unicode 38 | const ( 39 | UTF_8 Charset = "UTF-8" 40 | UTF_16 = "UTF-16" 41 | UTF_16BE = "UTF-16BE" 42 | UTF_16LE = "UTF-16LE" 43 | ) 44 | 45 | // 其他编码 46 | const ( 47 | Macintosh Charset = "macintosh" 48 | IBM = "IBM*" 49 | Windows = "Windows*" 50 | ISO = "ISO-*" 51 | ) 52 | 53 | var charsetAlias = map[string]string{ 54 | "HZGB2312": "HZ-GB-2312", 55 | "hzgb2312": "HZ-GB-2312", 56 | "GB2312": "HZ-GB-2312", 57 | "gb2312": "HZ-GB-2312", 58 | } 59 | 60 | func Convert(dstCharset Charset, srcCharset Charset, src string) (dst string, err error) { 61 | if dstCharset == srcCharset { 62 | return src, nil 63 | } 64 | dst = src 65 | // Converting to UTF-8. 66 | if srcCharset != "UTF-8" { 67 | if e := getEncoding(srcCharset); e != nil { 68 | tmp, err := ioutil.ReadAll( 69 | transform.NewReader(bytes.NewReader([]byte(src)), e.NewDecoder()), 70 | ) 71 | if err != nil { 72 | return "", fmt.Errorf("%s to utf8 failed. %v", srcCharset, err) 73 | } 74 | src = string(tmp) 75 | } else { 76 | return dst, errors.New(fmt.Sprintf("unsupport srcCharset: %s", srcCharset)) 77 | } 78 | } 79 | // Do the converting from UTF-8 to . 80 | if dstCharset != "UTF-8" { 81 | if e := getEncoding(dstCharset); e != nil { 82 | tmp, err := ioutil.ReadAll( 83 | transform.NewReader(bytes.NewReader([]byte(src)), e.NewEncoder()), 84 | ) 85 | if err != nil { 86 | return "", fmt.Errorf("utf to %s failed. %v", dstCharset, err) 87 | } 88 | dst = string(tmp) 89 | } else { 90 | return dst, errors.New(fmt.Sprintf("unsupport dstCharset: %s", dstCharset)) 91 | } 92 | } else { 93 | dst = src 94 | } 95 | return dst, nil 96 | } 97 | 98 | func ToUtf8(srcCharset Charset, src string) (dst string, err error) { 99 | return Convert("UTF-8", srcCharset, src) 100 | } 101 | 102 | func Utf8To(dstCharset Charset, src string) (dst string, err error) { 103 | return Convert(dstCharset, "UTF-8", src) 104 | } 105 | 106 | func IsUtf8(str string) bool { 107 | return utf8.ValidString(str) 108 | } 109 | 110 | func getEncoding(charset Charset) encoding.Encoding { 111 | if c, ok := charsetAlias[string(charset)]; ok { 112 | charset = Charset(c) 113 | } 114 | if e, err := ianaindex.MIB.Encoding(string(charset)); err == nil && e != nil { 115 | return e 116 | } 117 | return nil 118 | } 119 | -------------------------------------------------------------------------------- /options.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | "path/filepath" 9 | "reflect" 10 | "regexp" 11 | ) 12 | 13 | const FILE_NAME = "options.json" 14 | 15 | type Options struct { 16 | EraseZeroWidthCharacter bool `json:"eraseZeroWidthCharacter"` 17 | Regex []RegexConfig `json:"regex"` 18 | eachList []EachList 19 | } 20 | 21 | type RegexConfig struct { 22 | Regexp string `json:"regexp"` 23 | Value string `json:"value"` 24 | } 25 | 26 | type EachList struct { 27 | regexp *regexp.Regexp 28 | value string 29 | } 30 | 31 | // 载入配置 32 | func (opt *Options) load() { 33 | cwd, _ := os.Getwd() 34 | 35 | file, err := os.OpenFile(filepath.Join(cwd, FILE_NAME), os.O_RDWR|os.O_CREATE, os.ModePerm) 36 | if err != nil { 37 | fmt.Println(err.Error()) 38 | return 39 | } 40 | defer file.Close() 41 | 42 | content, err := ioutil.ReadAll(file) 43 | if err != nil { 44 | fmt.Println(err.Error()) 45 | return 46 | } 47 | 48 | if len(content) == 0 { 49 | opt.EraseZeroWidthCharacter = true 50 | opt.Regex = []RegexConfig{} 51 | data, _ := json.Marshal(opt) 52 | file.WriteString(string(data)) 53 | return 54 | } 55 | 56 | json.Unmarshal([]byte(content), &opt) 57 | } 58 | 59 | // 保存配置文件 60 | func (opt *Options) save() { 61 | cwd, _ := os.Getwd() 62 | file, err := os.OpenFile(filepath.Join(cwd, FILE_NAME), os.O_TRUNC|os.O_RDWR|os.O_CREATE, os.ModePerm) 63 | if err != nil { 64 | fmt.Println(err.Error()) 65 | return 66 | } 67 | defer file.Close() 68 | data, _ := json.Marshal(opt) 69 | file.WriteString(string(data)) 70 | } 71 | 72 | // 设置值 73 | func (opt *Options) set(key string, val bool) { 74 | switch key { 75 | case "EraseZeroWidthCharacter": 76 | opt.EraseZeroWidthCharacter = val 77 | } 78 | } 79 | 80 | // 添加正则 81 | func (opt *Options) addRegex(key string, val string) { 82 | opt.Regex = append(opt.Regex, RegexConfig{key, val}) 83 | } 84 | 85 | // SetData 存储新的配置 86 | func (opt *Options) SetData(newOpt *Options) { 87 | if reflect.DeepEqual(newOpt, opt) { 88 | return 89 | } 90 | optionByte, _ := json.Marshal(newOpt) 91 | err := json.Unmarshal(optionByte, &opt) 92 | if err != nil { 93 | return 94 | } 95 | opt.eachList = opt.eachList[0:0] 96 | opt.save() 97 | } 98 | 99 | // GetData 获取配置信息 100 | func (opt *Options) GetData() Options { 101 | return *opt 102 | } 103 | 104 | // 初始化正则列表 105 | func (opt *Options) initEachList() { 106 | opt.eachList = []EachList{} 107 | for _, item := range opt.Regex { 108 | if item.Regexp != "" { 109 | regex, err := regexp.Compile(item.Regexp) 110 | if err != nil { 111 | fmt.Println(err.Error()) 112 | return 113 | } 114 | item := EachList{ 115 | regex, 116 | item.Value, 117 | } 118 | opt.eachList = append(opt.eachList, item) 119 | } 120 | } 121 | } 122 | 123 | // ExecRegex 执行每一个正则替换 124 | func (opt *Options) ExecRegex(str string) string { 125 | if len(opt.eachList) == 0 { 126 | opt.initEachList() 127 | } 128 | result := str 129 | for _, item := range opt.eachList { 130 | result = item.regexp.ReplaceAllString(result, item.value) 131 | } 132 | return result 133 | } 134 | -------------------------------------------------------------------------------- /app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "context" 6 | "datafilter/charset" 7 | "fmt" 8 | "os" 9 | "path/filepath" 10 | "regexp" 11 | "strings" 12 | "time" 13 | 14 | "github.com/wailsapp/wails/v2/pkg/runtime" 15 | ) 16 | 17 | const FILE_ADD_SUFFIX = "_filter" 18 | 19 | var OPT = Options{} 20 | 21 | // App struct 22 | type App struct { 23 | ctx context.Context 24 | } 25 | 26 | // NewApp creates a new App application struct 27 | func NewApp() *App { 28 | return &App{} 29 | } 30 | 31 | // startup is called when the app starts. The context is saved 32 | // so we can call the runtime methods 33 | func (a *App) startup(ctx context.Context) { 34 | a.ctx = ctx 35 | OPT.load() 36 | } 37 | 38 | // Greet returns a greeting for the given name 39 | func (a *App) Greet(name string) string { 40 | return fmt.Sprintf("Greet %s !", name) 41 | } 42 | 43 | // GetOptions 获取配置文件JSON 44 | func (a *App) GetOptions() Options { 45 | return OPT.GetData() 46 | } 47 | 48 | // SetOptions 解析传来的配置 49 | func (a *App) SetOptions(val Options) { 50 | OPT.SetData(&val) 51 | } 52 | 53 | type PathStruct struct { 54 | Directory string `json:"directory"` 55 | Filename string `json:"filename"` 56 | Ext string `json:"ext"` 57 | AddSuffixStr string `json:"addSuffixStr"` 58 | } 59 | 60 | // SplitFilePath 拆分文件路径信息 61 | func (a *App) SplitFilePath(filePath string) PathStruct { 62 | directory, filename, ext := splitFilePath(filePath) 63 | return PathStruct{ 64 | directory, 65 | filename, 66 | ext, 67 | FILE_ADD_SUFFIX, 68 | } 69 | } 70 | 71 | // 分解文件路径 72 | func splitFilePath(filePath string) (string, string, string) { 73 | path, filename := filepath.Split(filePath) 74 | fileNameSp := strings.Split(filename, ".") 75 | return path, fileNameSp[0], fileNameSp[1] 76 | } 77 | 78 | // SelectFile 选择需要处理的文件 79 | func (a *App) SelectFile(title string, filetype string) string { 80 | if title == "" { 81 | title = "选择文件" 82 | } 83 | if filetype == "" { 84 | filetype = "*.txt;*.json" 85 | } 86 | selection, err := runtime.OpenFileDialog(a.ctx, runtime.OpenDialogOptions{ 87 | Title: title, 88 | Filters: []runtime.FileFilter{ 89 | { 90 | DisplayName: "文本数据", 91 | Pattern: filetype, 92 | }, 93 | }, 94 | }) 95 | if err != nil { 96 | return fmt.Sprintf("err %s!", err) 97 | } 98 | return selection 99 | } 100 | 101 | // FilterFile 处理文件数据 102 | func (a *App) FilterFile(filePath string) string { 103 | var checkCoding = false 104 | var isFileEncodingUtf8 bool 105 | timeStart := time.Now() 106 | // 读取文件 107 | fileHandle, err := os.Open(filePath) 108 | if err != nil { 109 | fmt.Println(err.Error()) 110 | return "" 111 | } 112 | defer fileHandle.Close() 113 | 114 | // 保存文件 115 | path, filename, ext := splitFilePath(filePath) 116 | newFilePath := path + filename + FILE_ADD_SUFFIX + "." + ext 117 | fileSaveHandle, err := os.OpenFile(newFilePath, os.O_RDWR|os.O_TRUNC|os.O_CREATE, os.ModePerm) 118 | if err != nil { 119 | fmt.Println(err.Error()) 120 | return "" 121 | } 122 | defer fileSaveHandle.Close() 123 | 124 | accumulationLine := 0 125 | bufSaveHandle := bufio.NewWriter(fileSaveHandle) 126 | lineScanner := bufio.NewScanner(fileHandle) 127 | for lineScanner.Scan() { 128 | newStr := lineScanner.Text() 129 | accumulationLine++ 130 | runtime.EventsEmit(a.ctx, "filter-change", accumulationLine) 131 | 132 | if !checkCoding { 133 | checkCoding = true 134 | isFileEncodingUtf8 = charset.IsUtf8(newStr) 135 | } 136 | if !isFileEncodingUtf8 { 137 | // 仅处理GBK情况 138 | newStr, _ = charset.ToUtf8(charset.GBK, newStr) 139 | } 140 | newStr = filterTextData(newStr) 141 | _, err := bufSaveHandle.WriteString(newStr + "\n") 142 | if err != nil { 143 | fmt.Println(err.Error()) 144 | return "" 145 | } 146 | } 147 | bufSaveHandle.Flush() 148 | 149 | return time.Now().Sub(timeStart).String() 150 | } 151 | 152 | // 文本处理 153 | func filterTextData(str string) string { 154 | result := str 155 | if OPT.EraseZeroWidthCharacter { 156 | result = eraseZeroWidthCharacter(str, "") 157 | } 158 | result = OPT.ExecRegex(result) 159 | return result 160 | } 161 | 162 | // 处理零宽字符 163 | func eraseZeroWidthCharacter(str string, val string) string { 164 | myRegex, err := regexp.Compile("[\u200b-\u200f|\ufefe]") 165 | if err != nil { 166 | fmt.Println(err) 167 | return str 168 | } 169 | result := myRegex.ReplaceAllString(str, val) 170 | return result 171 | } 172 | -------------------------------------------------------------------------------- /frontend/wailsjs/runtime/runtime.js: -------------------------------------------------------------------------------- 1 | /* 2 | _ __ _ __ 3 | | | / /___ _(_) /____ 4 | | | /| / / __ `/ / / ___/ 5 | | |/ |/ / /_/ / / (__ ) 6 | |__/|__/\__,_/_/_/____/ 7 | The electron alternative for Go 8 | (c) Lea Anthony 2019-present 9 | */ 10 | 11 | export function LogPrint(message) { 12 | window.runtime.LogPrint(message); 13 | } 14 | 15 | export function LogTrace(message) { 16 | window.runtime.LogTrace(message); 17 | } 18 | 19 | export function LogDebug(message) { 20 | window.runtime.LogDebug(message); 21 | } 22 | 23 | export function LogInfo(message) { 24 | window.runtime.LogInfo(message); 25 | } 26 | 27 | export function LogWarning(message) { 28 | window.runtime.LogWarning(message); 29 | } 30 | 31 | export function LogError(message) { 32 | window.runtime.LogError(message); 33 | } 34 | 35 | export function LogFatal(message) { 36 | window.runtime.LogFatal(message); 37 | } 38 | 39 | export function EventsOnMultiple(eventName, callback, maxCallbacks) { 40 | window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks); 41 | } 42 | 43 | export function EventsOn(eventName, callback) { 44 | EventsOnMultiple(eventName, callback, -1); 45 | } 46 | 47 | export function EventsOff(eventName) { 48 | return window.runtime.EventsOff(eventName); 49 | } 50 | 51 | export function EventsOnce(eventName, callback) { 52 | EventsOnMultiple(eventName, callback, 1); 53 | } 54 | 55 | export function EventsEmit(eventName) { 56 | let args = [eventName].slice.call(arguments); 57 | return window.runtime.EventsEmit.apply(null, args); 58 | } 59 | 60 | export function WindowReload() { 61 | window.runtime.WindowReload(); 62 | } 63 | 64 | export function WindowReloadApp() { 65 | window.runtime.WindowReloadApp(); 66 | } 67 | 68 | export function WindowSetSystemDefaultTheme() { 69 | window.runtime.WindowSetSystemDefaultTheme(); 70 | } 71 | 72 | export function WindowSetLightTheme() { 73 | window.runtime.WindowSetLightTheme(); 74 | } 75 | 76 | export function WindowSetDarkTheme() { 77 | window.runtime.WindowSetDarkTheme(); 78 | } 79 | 80 | export function WindowCenter() { 81 | window.runtime.WindowCenter(); 82 | } 83 | 84 | export function WindowSetTitle(title) { 85 | window.runtime.WindowSetTitle(title); 86 | } 87 | 88 | export function WindowFullscreen() { 89 | window.runtime.WindowFullscreen(); 90 | } 91 | 92 | export function WindowUnfullscreen() { 93 | window.runtime.WindowUnfullscreen(); 94 | } 95 | 96 | export function WindowGetSize() { 97 | return window.runtime.WindowGetSize(); 98 | } 99 | 100 | export function WindowSetSize(width, height) { 101 | window.runtime.WindowSetSize(width, height); 102 | } 103 | 104 | export function WindowSetMaxSize(width, height) { 105 | window.runtime.WindowSetMaxSize(width, height); 106 | } 107 | 108 | export function WindowSetMinSize(width, height) { 109 | window.runtime.WindowSetMinSize(width, height); 110 | } 111 | 112 | export function WindowSetPosition(x, y) { 113 | window.runtime.WindowSetPosition(x, y); 114 | } 115 | 116 | export function WindowGetPosition() { 117 | return window.runtime.WindowGetPosition(); 118 | } 119 | 120 | export function WindowHide() { 121 | window.runtime.WindowHide(); 122 | } 123 | 124 | export function WindowShow() { 125 | window.runtime.WindowShow(); 126 | } 127 | 128 | export function WindowMaximise() { 129 | window.runtime.WindowMaximise(); 130 | } 131 | 132 | export function WindowToggleMaximise() { 133 | window.runtime.WindowToggleMaximise(); 134 | } 135 | 136 | export function WindowUnmaximise() { 137 | window.runtime.WindowUnmaximise(); 138 | } 139 | 140 | export function WindowMinimise() { 141 | window.runtime.WindowMinimise(); 142 | } 143 | 144 | export function WindowUnminimise() { 145 | window.runtime.WindowUnminimise(); 146 | } 147 | 148 | export function WindowSetBackgroundColour(R, G, B, A) { 149 | window.runtime.WindowSetBackgroundColour(R, G, B, A); 150 | } 151 | 152 | export function ScreenGetAll() { 153 | return window.runtime.ScreenGetAll(); 154 | } 155 | 156 | export function BrowserOpenURL(url) { 157 | window.runtime.BrowserOpenURL(url); 158 | } 159 | 160 | export function Environment() { 161 | return window.runtime.Environment(); 162 | } 163 | 164 | export function Quit() { 165 | window.runtime.Quit(); 166 | } 167 | 168 | export function Hide() { 169 | window.runtime.Hide(); 170 | } 171 | 172 | export function Show() { 173 | window.runtime.Show(); 174 | } 175 | -------------------------------------------------------------------------------- /frontend/src/assets/fonts/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com), 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /frontend/src/components/Options.vue: -------------------------------------------------------------------------------- 1 | 74 | 75 | 119 | 120 | 159 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY= 2 | github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= 3 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 5 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 6 | github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= 7 | github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= 8 | github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= 9 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 10 | github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= 11 | github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 12 | github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck= 13 | github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs= 14 | github.com/labstack/echo/v4 v4.7.2 h1:Kv2/p8OaQ+M6Ex4eGimg9b9e6icoxA42JSlOR3msKtI= 15 | github.com/labstack/echo/v4 v4.7.2/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= 16 | github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= 17 | github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= 18 | github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc= 19 | github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA= 20 | github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4= 21 | github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM= 22 | github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ= 23 | github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4= 24 | github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY= 25 | github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY= 26 | github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= 27 | github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= 28 | github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= 29 | github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= 30 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= 31 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 32 | github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 h1:acNfDZXmm28D2Yg/c3ALnZStzNaZMSagpbr96vY6Zjc= 33 | github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 34 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 35 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 36 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 37 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 38 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 39 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= 40 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 41 | github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ= 42 | github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4= 43 | github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= 44 | github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= 45 | github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= 46 | github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= 47 | github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= 48 | github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= 49 | github.com/wailsapp/wails/v2 v2.0.0-beta.44.2 h1:fnOjRIan7rZLq6UGeBItBa4dBuUXcyTObh5VNZL3StM= 50 | github.com/wailsapp/wails/v2 v2.0.0-beta.44.2/go.mod h1:GplgLNVum9fEKu7Y4nq289pxHs7Htbp/UG7uhPr5zD0= 51 | golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= 52 | golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 53 | golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 54 | golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= 55 | golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 56 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 57 | golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 58 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 59 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 60 | golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 61 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 62 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 63 | golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 64 | golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= 65 | golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 66 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 67 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 68 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 69 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 70 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 71 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 72 | gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= 73 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 74 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 75 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= 76 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 77 | -------------------------------------------------------------------------------- /frontend/src/components/Upload.vue: -------------------------------------------------------------------------------- 1 | 87 | 88 | 173 | 174 | 288 | -------------------------------------------------------------------------------- /frontend/wailsjs/runtime/runtime.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | _ __ _ __ 3 | | | / /___ _(_) /____ 4 | | | /| / / __ `/ / / ___/ 5 | | |/ |/ / /_/ / / (__ ) 6 | |__/|__/\__,_/_/_/____/ 7 | The electron alternative for Go 8 | (c) Lea Anthony 2019-present 9 | */ 10 | 11 | export interface Position { 12 | x: number; 13 | y: number; 14 | } 15 | 16 | export interface Size { 17 | w: number; 18 | h: number; 19 | } 20 | 21 | export interface Screen { 22 | isCurrent: boolean; 23 | isPrimary: boolean; 24 | width : number 25 | height : number 26 | } 27 | 28 | // Environment information such as platform, buildtype, ... 29 | export interface EnvironmentInfo { 30 | buildType: string; 31 | platform: string; 32 | arch: string; 33 | } 34 | 35 | // [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit) 36 | // emits the given event. Optional data may be passed with the event. 37 | // This will trigger any event listeners. 38 | export function EventsEmit(eventName: string, ...data: any): void; 39 | 40 | // [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name. 41 | export function EventsOn(eventName: string, callback: (...data: any) => void): void; 42 | 43 | // [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple) 44 | // sets up a listener for the given event name, but will only trigger a given number times. 45 | export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): void; 46 | 47 | // [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce) 48 | // sets up a listener for the given event name, but will only trigger once. 49 | export function EventsOnce(eventName: string, callback: (...data: any) => void): void; 50 | 51 | // [EventsOff](https://wails.io/docs/reference/runtime/events#eventsff) 52 | // unregisters the listener for the given event name. 53 | export function EventsOff(eventName: string): void; 54 | 55 | // [LogPrint](https://wails.io/docs/reference/runtime/log#logprint) 56 | // logs the given message as a raw message 57 | export function LogPrint(message: string): void; 58 | 59 | // [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace) 60 | // logs the given message at the `trace` log level. 61 | export function LogTrace(message: string): void; 62 | 63 | // [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug) 64 | // logs the given message at the `debug` log level. 65 | export function LogDebug(message: string): void; 66 | 67 | // [LogError](https://wails.io/docs/reference/runtime/log#logerror) 68 | // logs the given message at the `error` log level. 69 | export function LogError(message: string): void; 70 | 71 | // [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal) 72 | // logs the given message at the `fatal` log level. 73 | // The application will quit after calling this method. 74 | export function LogFatal(message: string): void; 75 | 76 | // [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo) 77 | // logs the given message at the `info` log level. 78 | export function LogInfo(message: string): void; 79 | 80 | // [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning) 81 | // logs the given message at the `warning` log level. 82 | export function LogWarning(message: string): void; 83 | 84 | // [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload) 85 | // Forces a reload by the main application as well as connected browsers. 86 | export function WindowReload(): void; 87 | 88 | // [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp) 89 | // Reloads the application frontend. 90 | export function WindowReloadApp(): void; 91 | 92 | // [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme) 93 | // *Windows only* 94 | // Sets window theme to system default (dark/light). 95 | export function WindowSetSystemDefaultTheme(): void; 96 | 97 | // [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme) 98 | // *Windows only* 99 | // Sets window to light theme. 100 | export function WindowSetLightTheme(): void; 101 | 102 | // [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme) 103 | // *Windows only* 104 | // Sets window to dark theme. 105 | export function WindowSetDarkTheme(): void; 106 | 107 | // [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter) 108 | // Centers the window on the monitor the window is currently on. 109 | export function WindowCenter(): void; 110 | 111 | // [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle) 112 | // Sets the text in the window title bar. 113 | export function WindowSetTitle(title: string): void; 114 | 115 | // [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen) 116 | // Makes the window full screen. 117 | export function WindowFullscreen(): void; 118 | 119 | // [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen) 120 | // Restores the previous window dimensions and position prior to full screen. 121 | export function WindowUnfullscreen(): void; 122 | 123 | // [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize) 124 | // Sets the width and height of the window. 125 | export function WindowSetSize(width: number, height: number): Promise; 126 | 127 | // [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize) 128 | // Gets the width and height of the window. 129 | export function WindowGetSize(): Promise; 130 | 131 | // [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize) 132 | // Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions. 133 | // Setting a size of 0,0 will disable this constraint. 134 | export function WindowSetMaxSize(width: number, height: number): void; 135 | 136 | // [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize) 137 | // Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions. 138 | // Setting a size of 0,0 will disable this constraint. 139 | export function WindowSetMinSize(width: number, height: number): void; 140 | 141 | // [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition) 142 | // Sets the window position relative to the monitor the window is currently on. 143 | export function WindowSetPosition(x: number, y: number): void; 144 | 145 | // [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition) 146 | // Gets the window position relative to the monitor the window is currently on. 147 | export function WindowGetPosition(): Promise; 148 | 149 | // [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide) 150 | // Hides the window. 151 | export function WindowHide(): void; 152 | 153 | // [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow) 154 | // Shows the window, if it is currently hidden. 155 | export function WindowShow(): void; 156 | 157 | // [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise) 158 | // Maximises the window to fill the screen. 159 | export function WindowMaximise(): void; 160 | 161 | // [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise) 162 | // Toggles between Maximised and UnMaximised. 163 | export function WindowToggleMaximise(): void; 164 | 165 | // [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise) 166 | // Restores the window to the dimensions and position prior to maximising. 167 | export function WindowUnmaximise(): void; 168 | 169 | // [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise) 170 | // Minimises the window. 171 | export function WindowMinimise(): void; 172 | 173 | // [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise) 174 | // Restores the window to the dimensions and position prior to minimising. 175 | export function WindowUnminimise(): void; 176 | 177 | // [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour) 178 | // Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels. 179 | export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void; 180 | 181 | // [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall) 182 | // Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system. 183 | export function ScreenGetAll(): Promise; 184 | 185 | // [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl) 186 | // Opens the given URL in the system browser. 187 | export function BrowserOpenURL(url: string): void; 188 | 189 | // [Environment](https://wails.io/docs/reference/runtime/intro#environment) 190 | // Returns information about the environment 191 | export function Environment(): Promise; 192 | 193 | // [Quit](https://wails.io/docs/reference/runtime/intro#quit) 194 | // Quits the application. 195 | export function Quit(): void; 196 | 197 | // [Hide](https://wails.io/docs/reference/runtime/intro#hide) 198 | // Hides the application. 199 | export function Hide(): void; 200 | 201 | // [Show](https://wails.io/docs/reference/runtime/intro#show) 202 | // Shows the application. 203 | export function Show(): void; 204 | --------------------------------------------------------------------------------