mirror of
https://github.com/HACKERALERT/Picocrypt.git
synced 2024-11-10 04:48:01 +00:00
Use native clipboard
This commit is contained in:
parent
d59b99a43d
commit
b3dc607e05
3 changed files with 21 additions and 36 deletions
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
/*
|
||||
|
||||
Picocrypt v1.30
|
||||
Picocrypt v1.31
|
||||
Copyright (c) Evan Su
|
||||
Released under a GNU GPL v3 License
|
||||
https://github.com/HACKERALERT/Picocrypt
|
||||
|
@ -32,7 +32,6 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/HACKERALERT/clipboard"
|
||||
"github.com/HACKERALERT/crypto/argon2"
|
||||
"github.com/HACKERALERT/crypto/blake2b"
|
||||
"github.com/HACKERALERT/crypto/chacha20"
|
||||
|
@ -59,7 +58,7 @@ var TRANSPARENT = color.RGBA{0x00, 0x00, 0x00, 0x00}
|
|||
|
||||
// Generic variables
|
||||
var window *giu.MasterWindow
|
||||
var version = "v1.30"
|
||||
var version = "v1.31"
|
||||
var dpi float32
|
||||
var mode string
|
||||
var working bool
|
||||
|
@ -182,9 +181,7 @@ func draw() {
|
|||
giu.Checkbox("Lowercase", &passgenLower),
|
||||
giu.Checkbox("Numbers", &passgenNums),
|
||||
giu.Checkbox("Symbols", &passgenSymbols),
|
||||
giu.Style().SetDisabled(clipboard.Unsupported).To(
|
||||
giu.Checkbox("Copy to clipboard", &passgenCopy),
|
||||
),
|
||||
giu.Row(
|
||||
giu.Button("Cancel").Size(100, 0).OnClick(func() {
|
||||
giu.CloseCurrentPopup()
|
||||
|
@ -339,16 +336,14 @@ func draw() {
|
|||
}),
|
||||
giu.Tooltip("Clear the password entries."),
|
||||
|
||||
giu.Style().SetDisabled(clipboard.Unsupported).To(
|
||||
giu.Row(
|
||||
giu.Button("Copy").Size(54, 0).OnClick(func() {
|
||||
clipboard.WriteAll(password)
|
||||
giu.Context.GetPlatform().SetClipboard(password)
|
||||
giu.Update()
|
||||
}),
|
||||
giu.Tooltip("Copy the password into your clipboard."),
|
||||
|
||||
giu.Button("Paste").Size(54, 0).OnClick(func() {
|
||||
tmp, _ := clipboard.ReadAll()
|
||||
tmp := giu.Context.GetPlatform().GetClipboard()
|
||||
password = tmp
|
||||
if mode != "decrypt" {
|
||||
cpassword = tmp
|
||||
|
@ -357,8 +352,6 @@ func draw() {
|
|||
giu.Update()
|
||||
}),
|
||||
giu.Tooltip("Paste a password from your clipboard."),
|
||||
),
|
||||
),
|
||||
|
||||
giu.Style().SetDisabled(mode == "decrypt").To(
|
||||
giu.Button("Create").Size(54, 0).OnClick(func() {
|
||||
|
@ -782,7 +775,7 @@ func onDrop(names []string) {
|
|||
tmp := make([]byte, 15)
|
||||
fin.Read(tmp)
|
||||
tmp, err = rsDecode(rs5, tmp)
|
||||
if valid, _ := regexp.Match(`^v\d\.\d{2}`, tmp); !valid || err != nil {
|
||||
if valid, _ := regexp.Match(`^v1\.\d{2}`, tmp); !valid || err != nil {
|
||||
resetUI()
|
||||
mainStatus = "This doesn't seem like a Picocrypt volume."
|
||||
mainStatusColor = RED
|
||||
|
@ -1883,7 +1876,7 @@ func resetUI() {
|
|||
passgenLower = true
|
||||
passgenNums = true
|
||||
passgenSymbols = true
|
||||
passgenCopy = !clipboard.Unsupported
|
||||
passgenCopy = true
|
||||
|
||||
keyfile = false
|
||||
keyfiles = nil
|
||||
|
@ -1984,7 +1977,7 @@ func genPassword() string {
|
|||
tmp[i] = chars[j.Int64()]
|
||||
}
|
||||
if passgenCopy {
|
||||
clipboard.WriteAll(string(tmp))
|
||||
giu.Context.GetPlatform().SetClipboard(string(tmp))
|
||||
}
|
||||
return string(tmp)
|
||||
}
|
||||
|
@ -2039,11 +2032,6 @@ func main() {
|
|||
// Set universal DPI
|
||||
dpi = giu.Context.GetPlatform().GetContentScale()
|
||||
|
||||
// Check for clipboard support
|
||||
if clipboard.Unsupported {
|
||||
mainStatus = "Ready. (Note: No clipboard support found.)"
|
||||
}
|
||||
|
||||
// Start the UI
|
||||
window.Run(draw)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ module Picocrypt
|
|||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/HACKERALERT/clipboard v0.1.5-0.20220507233423-cccec4a4226a
|
||||
github.com/HACKERALERT/crypto v0.0.0-20220905152506-aa0dd62d8f67
|
||||
github.com/HACKERALERT/dialog v0.0.0-20220508022504-af3bc34fe379
|
||||
github.com/HACKERALERT/giu v0.5.7-0.20221117223150-211c1da061d9
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
github.com/HACKERALERT/clipboard v0.1.5-0.20220507233423-cccec4a4226a h1:AJwVJ8FRAwocNV6jjwcexiMIH0q+LvDxGpln9tLBZ/8=
|
||||
github.com/HACKERALERT/clipboard v0.1.5-0.20220507233423-cccec4a4226a/go.mod h1:io5lk+xSkGqXRrXYAtBjyIpUBH9yPmbwyMPvBUmCNeg=
|
||||
github.com/HACKERALERT/crypto v0.0.0-20220905152506-aa0dd62d8f67 h1:4WfPIopYjvBjyDg0IET7mEj32kkihLmvFgwCOmldqK8=
|
||||
github.com/HACKERALERT/crypto v0.0.0-20220905152506-aa0dd62d8f67/go.mod h1:qiHCxMDsCxX4QhXd3kDYWiNOR/DZQZ7nYO/f2OgWst0=
|
||||
github.com/HACKERALERT/dialog v0.0.0-20220508022504-af3bc34fe379 h1:GR92LbksZ8zdbzQHf2dTI7e7P8Mjbdi5mSmQv2SK2Uw=
|
||||
|
|
Loading…
Reference in a new issue