mirror of
https://github.com/Picocrypt/Picocrypt.git
synced 2025-05-12 21:58:31 +02:00
Merge pull request #37 from Retengart/dots
deleted unnecessary dots at the end of sentences, bump to 1.38
This commit is contained in:
commit
0dadb24304
2 changed files with 78 additions and 78 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
1.37
|
1.38
|
||||||
|
|
154
src/Picocrypt.go
154
src/Picocrypt.go
|
@ -2,7 +2,7 @@ package main
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Picocrypt v1.34
|
Picocrypt v1.38
|
||||||
Copyright (c) Evan Su
|
Copyright (c) Evan Su
|
||||||
Released under a GNU GPL v3 License
|
Released under a GNU GPL v3 License
|
||||||
https://github.com/Picocrypt/Picocrypt
|
https://github.com/Picocrypt/Picocrypt
|
||||||
|
@ -58,7 +58,7 @@ var TRANSPARENT = color.RGBA{0x00, 0x00, 0x00, 0x00}
|
||||||
|
|
||||||
// Generic variables
|
// Generic variables
|
||||||
var window *giu.MasterWindow
|
var window *giu.MasterWindow
|
||||||
var version = "v1.33"
|
var version = "v1.38"
|
||||||
var dpi float32
|
var dpi float32
|
||||||
var mode string
|
var mode string
|
||||||
var working bool
|
var working bool
|
||||||
|
@ -78,7 +78,7 @@ var outputFile string
|
||||||
var onlyFiles []string
|
var onlyFiles []string
|
||||||
var onlyFolders []string
|
var onlyFolders []string
|
||||||
var allFiles []string
|
var allFiles []string
|
||||||
var inputLabel = "Drop files and folders into this window."
|
var inputLabel = "Drop files and folders into this window"
|
||||||
|
|
||||||
// Password and confirm password
|
// Password and confirm password
|
||||||
var password string
|
var password string
|
||||||
|
@ -99,7 +99,7 @@ var passgenCopy bool
|
||||||
var keyfile bool
|
var keyfile bool
|
||||||
var keyfiles []string
|
var keyfiles []string
|
||||||
var keyfileOrdered bool
|
var keyfileOrdered bool
|
||||||
var keyfileLabel = "None selected."
|
var keyfileLabel = "None selected"
|
||||||
|
|
||||||
// Comments variables
|
// Comments variables
|
||||||
var comments string
|
var comments string
|
||||||
|
@ -123,7 +123,7 @@ var kept bool
|
||||||
|
|
||||||
// Status variables
|
// Status variables
|
||||||
var startLabel = "Start"
|
var startLabel = "Start"
|
||||||
var mainStatus = "Ready."
|
var mainStatus = "Ready"
|
||||||
var mainStatusColor = WHITE
|
var mainStatusColor = WHITE
|
||||||
var popupStatus string
|
var popupStatus string
|
||||||
|
|
||||||
|
@ -207,13 +207,13 @@ func draw() {
|
||||||
|
|
||||||
if showKeyfile {
|
if showKeyfile {
|
||||||
giu.PopupModal("Manage keyfiles:##"+strconv.Itoa(modalId)).Flags(70).Layout(
|
giu.PopupModal("Manage keyfiles:##"+strconv.Itoa(modalId)).Flags(70).Layout(
|
||||||
giu.Label("Drag and drop your keyfiles here."),
|
giu.Label("Drag and drop your keyfiles here"),
|
||||||
giu.Custom(func() {
|
giu.Custom(func() {
|
||||||
if mode != "decrypt" {
|
if mode != "decrypt" {
|
||||||
giu.Checkbox("Require correct order", &keyfileOrdered).Build()
|
giu.Checkbox("Require correct order", &keyfileOrdered).Build()
|
||||||
giu.Tooltip("Ordering of keyfiles will matter.").Build()
|
giu.Tooltip("Ordering of keyfiles will matter").Build()
|
||||||
} else if keyfileOrdered {
|
} else if keyfileOrdered {
|
||||||
giu.Label("Correct ordering is required.").Build()
|
giu.Label("Correct ordering is required").Build()
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
giu.Custom(func() {
|
giu.Custom(func() {
|
||||||
|
@ -228,14 +228,14 @@ func draw() {
|
||||||
giu.Button("Clear").Size(100, 0).OnClick(func() {
|
giu.Button("Clear").Size(100, 0).OnClick(func() {
|
||||||
keyfiles = nil
|
keyfiles = nil
|
||||||
if keyfile {
|
if keyfile {
|
||||||
keyfileLabel = "Keyfiles required."
|
keyfileLabel = "Keyfiles required"
|
||||||
} else {
|
} else {
|
||||||
keyfileLabel = "None selected."
|
keyfileLabel = "None selected"
|
||||||
}
|
}
|
||||||
modalId++
|
modalId++
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Remove all keyfiles."),
|
giu.Tooltip("Remove all keyfiles"),
|
||||||
|
|
||||||
giu.Button("Done").Size(100, 0).OnClick(func() {
|
giu.Button("Done").Size(100, 0).OnClick(func() {
|
||||||
giu.CloseCurrentPopup()
|
giu.CloseCurrentPopup()
|
||||||
|
@ -310,7 +310,7 @@ func draw() {
|
||||||
giu.SameLine()
|
giu.SameLine()
|
||||||
giu.Style().SetDisabled((len(allFiles) == 0 && len(onlyFiles) == 0) || scanning).To(
|
giu.Style().SetDisabled((len(allFiles) == 0 && len(onlyFiles) == 0) || scanning).To(
|
||||||
giu.Button("Clear").Size(bw/dpi, 0).OnClick(resetUI),
|
giu.Button("Clear").Size(bw/dpi, 0).OnClick(resetUI),
|
||||||
giu.Tooltip("Clear all input files and reset UI state."),
|
giu.Tooltip("Clear all input files and reset UI state"),
|
||||||
).Build()
|
).Build()
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
@ -329,20 +329,20 @@ func draw() {
|
||||||
}
|
}
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Toggle the visibility of password entries."),
|
giu.Tooltip("Toggle the visibility of password entries"),
|
||||||
|
|
||||||
giu.Button("Clear").Size(54, 0).OnClick(func() {
|
giu.Button("Clear").Size(54, 0).OnClick(func() {
|
||||||
password = ""
|
password = ""
|
||||||
cpassword = ""
|
cpassword = ""
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Clear the password entries."),
|
giu.Tooltip("Clear the password entries"),
|
||||||
|
|
||||||
giu.Button("Copy").Size(54, 0).OnClick(func() {
|
giu.Button("Copy").Size(54, 0).OnClick(func() {
|
||||||
giu.Context.GetPlatform().SetClipboard(password)
|
giu.Context.GetPlatform().SetClipboard(password)
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Copy the password into your clipboard."),
|
giu.Tooltip("Copy the password into your clipboard"),
|
||||||
|
|
||||||
giu.Button("Paste").Size(54, 0).OnClick(func() {
|
giu.Button("Paste").Size(54, 0).OnClick(func() {
|
||||||
tmp := giu.Context.GetPlatform().GetClipboard()
|
tmp := giu.Context.GetPlatform().GetClipboard()
|
||||||
|
@ -353,7 +353,7 @@ func draw() {
|
||||||
passwordStrength = zxcvbn.PasswordStrength(password, nil).Score
|
passwordStrength = zxcvbn.PasswordStrength(password, nil).Score
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Paste a password from your clipboard."),
|
giu.Tooltip("Paste a password from your clipboard"),
|
||||||
|
|
||||||
giu.Style().SetDisabled(mode == "decrypt").To(
|
giu.Style().SetDisabled(mode == "decrypt").To(
|
||||||
giu.Button("Create").Size(54, 0).OnClick(func() {
|
giu.Button("Create").Size(54, 0).OnClick(func() {
|
||||||
|
@ -362,7 +362,7 @@ func draw() {
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
giu.Tooltip("Generate a cryptographically secure password."),
|
giu.Tooltip("Generate a cryptographically secure password"),
|
||||||
),
|
),
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.InputText(&password).Flags(passwordState).Size(302/dpi).OnChange(func() {
|
giu.InputText(&password).Flags(passwordState).Size(302/dpi).OnChange(func() {
|
||||||
|
@ -424,14 +424,14 @@ func draw() {
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Manage keyfiles to use for "+(func() string {
|
giu.Tooltip("Manage keyfiles to use for "+(func() string {
|
||||||
if mode != "decrypt" {
|
if mode != "decrypt" {
|
||||||
return "encryption."
|
return "encryption"
|
||||||
}
|
}
|
||||||
return "decryption."
|
return "decryption"
|
||||||
}())),
|
}())),
|
||||||
|
|
||||||
giu.Style().SetDisabled(mode == "decrypt").To(
|
giu.Style().SetDisabled(mode == "decrypt").To(
|
||||||
giu.Button("Create").Size(54, 0).OnClick(func() {
|
giu.Button("Create").Size(54, 0).OnClick(func() {
|
||||||
f := dialog.File().Title("Choose where to save the keyfile.")
|
f := dialog.File().Title("Choose where to save the keyfile")
|
||||||
f.SetStartDir(func() string {
|
f.SetStartDir(func() string {
|
||||||
if len(onlyFiles) > 0 {
|
if len(onlyFiles) > 0 {
|
||||||
return filepath.Dir(onlyFiles[0])
|
return filepath.Dir(onlyFiles[0])
|
||||||
|
@ -453,11 +453,11 @@ func draw() {
|
||||||
insufficientSpace(nil, nil)
|
insufficientSpace(nil, nil)
|
||||||
os.Remove(file)
|
os.Remove(file)
|
||||||
} else {
|
} else {
|
||||||
mainStatus = "Ready."
|
mainStatus = "Ready"
|
||||||
mainStatusColor = WHITE
|
mainStatusColor = WHITE
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Generate a cryptographically secure keyfile."),
|
giu.Tooltip("Generate a cryptographically secure keyfile"),
|
||||||
),
|
),
|
||||||
giu.Style().SetDisabled(true).To(
|
giu.Style().SetDisabled(true).To(
|
||||||
giu.InputText(&keyfileLabel).Size(giu.Auto),
|
giu.InputText(&keyfileLabel).Size(giu.Auto),
|
||||||
|
@ -468,7 +468,7 @@ func draw() {
|
||||||
|
|
||||||
giu.Separator(),
|
giu.Separator(),
|
||||||
giu.Style().SetDisabled(mode != "decrypt" && ((len(keyfiles) == 0 && password == "") || (password != cpassword))).To(
|
giu.Style().SetDisabled(mode != "decrypt" && ((len(keyfiles) == 0 && password == "") || (password != cpassword))).To(
|
||||||
giu.Style().SetDisabled(mode == "decrypt" && (comments == "" || comments == "Comments are corrupted.")).To(
|
giu.Style().SetDisabled(mode == "decrypt" && (comments == "" || comments == "Comments are corrupted")).To(
|
||||||
giu.Label(commentsLabel),
|
giu.Label(commentsLabel),
|
||||||
giu.InputText(&comments).Size(giu.Auto).Flags(func() giu.InputTextFlags {
|
giu.InputText(&comments).Size(giu.Auto).Flags(func() giu.InputTextFlags {
|
||||||
if commentsDisabled {
|
if commentsDisabled {
|
||||||
|
@ -489,7 +489,7 @@ func draw() {
|
||||||
if mode != "decrypt" {
|
if mode != "decrypt" {
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Checkbox("Paranoid mode", ¶noid),
|
giu.Checkbox("Paranoid mode", ¶noid),
|
||||||
giu.Tooltip("Provides the highest level of security attainable."),
|
giu.Tooltip("Provides the highest level of security attainable"),
|
||||||
giu.Dummy(-170, 0),
|
giu.Dummy(-170, 0),
|
||||||
giu.Style().SetDisabled(recursively).To(
|
giu.Style().SetDisabled(recursively).To(
|
||||||
giu.Checkbox("Compress files", &compress).OnChange(func() {
|
giu.Checkbox("Compress files", &compress).OnChange(func() {
|
||||||
|
@ -501,50 +501,50 @@ func draw() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Compress files with Deflate before encrypting."),
|
giu.Tooltip("Compress files with Deflate before encrypting"),
|
||||||
),
|
),
|
||||||
).Build()
|
).Build()
|
||||||
|
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Checkbox("Reed-Solomon", &reedsolo),
|
giu.Checkbox("Reed-Solomon", &reedsolo),
|
||||||
giu.Tooltip("Prevent file corruption with erasure coding."),
|
giu.Tooltip("Prevent file corruption with erasure coding"),
|
||||||
giu.Dummy(-170, 0),
|
giu.Dummy(-170, 0),
|
||||||
giu.Checkbox("Delete files", &delete),
|
giu.Checkbox("Delete files", &delete),
|
||||||
giu.Tooltip("Delete the input files after encryption."),
|
giu.Tooltip("Delete the input files after encryption"),
|
||||||
).Build()
|
).Build()
|
||||||
|
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Checkbox("Deniability", &deniability),
|
giu.Checkbox("Deniability", &deniability),
|
||||||
giu.Tooltip("Add plausible deniability to the volume."),
|
giu.Tooltip("Add plausible deniability to the volume"),
|
||||||
giu.Dummy(-170, 0),
|
giu.Dummy(-170, 0),
|
||||||
giu.Style().SetDisabled(!(len(allFiles) > 1 || len(onlyFolders) > 0)).To(
|
giu.Style().SetDisabled(!(len(allFiles) > 1 || len(onlyFolders) > 0)).To(
|
||||||
giu.Checkbox("Recursively", &recursively).OnChange(func() {
|
giu.Checkbox("Recursively", &recursively).OnChange(func() {
|
||||||
compress = false
|
compress = false
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Encrypt and decrypt recursive files individually."),
|
giu.Tooltip("Encrypt and decrypt recursive files individually"),
|
||||||
),
|
),
|
||||||
).Build()
|
).Build()
|
||||||
|
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Checkbox("Split into chunks:", &split),
|
giu.Checkbox("Split into chunks:", &split),
|
||||||
giu.Tooltip("Split the output file into smaller chunks."),
|
giu.Tooltip("Split the output file into smaller chunks"),
|
||||||
giu.Dummy(-170, 0),
|
giu.Dummy(-170, 0),
|
||||||
giu.InputText(&splitSize).Size(86/dpi).Flags(2).OnChange(func() {
|
giu.InputText(&splitSize).Size(86/dpi).Flags(2).OnChange(func() {
|
||||||
split = splitSize != ""
|
split = splitSize != ""
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Choose the chunk size."),
|
giu.Tooltip("Choose the chunk size"),
|
||||||
giu.Combo("##splitter", splitUnits[splitSelected], splitUnits, &splitSelected).Size(68),
|
giu.Combo("##splitter", splitUnits[splitSelected], splitUnits, &splitSelected).Size(68),
|
||||||
giu.Tooltip("Choose the chunk units."),
|
giu.Tooltip("Choose the chunk units"),
|
||||||
).Build()
|
).Build()
|
||||||
} else {
|
} else {
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Style().SetDisabled(deniability).To(
|
giu.Style().SetDisabled(deniability).To(
|
||||||
giu.Checkbox("Force decrypt", &keep),
|
giu.Checkbox("Force decrypt", &keep),
|
||||||
giu.Tooltip("Override security measures when decrypting."),
|
giu.Tooltip("Override security measures when decrypting"),
|
||||||
),
|
),
|
||||||
giu.Dummy(-170, 0),
|
giu.Dummy(-170, 0),
|
||||||
giu.Checkbox("Delete volume", &delete),
|
giu.Checkbox("Delete volume", &delete),
|
||||||
giu.Tooltip("Delete the volume after a successful decryption."),
|
giu.Tooltip("Delete the volume after a successful decryption"),
|
||||||
).Build()
|
).Build()
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -576,7 +576,7 @@ func draw() {
|
||||||
|
|
||||||
giu.SameLine()
|
giu.SameLine()
|
||||||
giu.Button("Change").Size(bw/dpi, 0).OnClick(func() {
|
giu.Button("Change").Size(bw/dpi, 0).OnClick(func() {
|
||||||
f := dialog.File().Title("Choose where to save the output. Don't include extensions.")
|
f := dialog.File().Title("Choose where to save the output. Don't include extensions")
|
||||||
f.SetStartDir(func() string {
|
f.SetStartDir(func() string {
|
||||||
if len(onlyFiles) > 0 {
|
if len(onlyFiles) > 0 {
|
||||||
return filepath.Dir(onlyFiles[0])
|
return filepath.Dir(onlyFiles[0])
|
||||||
|
@ -614,10 +614,10 @@ func draw() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outputFile = file
|
outputFile = file
|
||||||
mainStatus = "Ready."
|
mainStatus = "Ready"
|
||||||
mainStatusColor = WHITE
|
mainStatusColor = WHITE
|
||||||
}).Build()
|
}).Build()
|
||||||
giu.Tooltip("Save the output with a custom name and path.").Build()
|
giu.Tooltip("Save the output with a custom name and path").Build()
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -631,13 +631,13 @@ func draw() {
|
||||||
return "Process"
|
return "Process"
|
||||||
}()).Size(giu.Auto, 34).OnClick(func() {
|
}()).Size(giu.Auto, 34).OnClick(func() {
|
||||||
if keyfile && keyfiles == nil {
|
if keyfile && keyfiles == nil {
|
||||||
mainStatus = "Please select your keyfiles."
|
mainStatus = "Please select your keyfiles"
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tmp, err := strconv.Atoi(splitSize)
|
tmp, err := strconv.Atoi(splitSize)
|
||||||
if split && (splitSize == "" || tmp <= 0 || err != nil) {
|
if split && (splitSize == "" || tmp <= 0 || err != nil) {
|
||||||
mainStatus = "Invalid chunk size."
|
mainStatus = "Invalid chunk size"
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -769,11 +769,11 @@ func onDrop(names []string) {
|
||||||
|
|
||||||
// Update the keyfile status
|
// Update the keyfile status
|
||||||
if len(keyfiles) == 0 {
|
if len(keyfiles) == 0 {
|
||||||
keyfileLabel = "None selected."
|
keyfileLabel = "None selected"
|
||||||
} else if len(keyfiles) == 1 {
|
} else if len(keyfiles) == 1 {
|
||||||
keyfileLabel = "Using 1 keyfile."
|
keyfileLabel = "Using 1 keyfile"
|
||||||
} else {
|
} else {
|
||||||
keyfileLabel = fmt.Sprintf("Using %d keyfiles.", len(keyfiles))
|
keyfileLabel = fmt.Sprintf("Using %d keyfiles", len(keyfiles))
|
||||||
}
|
}
|
||||||
|
|
||||||
modalId++
|
modalId++
|
||||||
|
@ -794,7 +794,7 @@ func onDrop(names []string) {
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
folders++
|
folders++
|
||||||
mode = "encrypt"
|
mode = "encrypt"
|
||||||
inputLabel = "1 folder."
|
inputLabel = "1 folder"
|
||||||
startLabel = "Encrypt"
|
startLabel = "Encrypt"
|
||||||
onlyFolders = append(onlyFolders, names[0])
|
onlyFolders = append(onlyFolders, names[0])
|
||||||
inputFile = filepath.Join(filepath.Dir(names[0]), "Encrypted") + ".zip"
|
inputFile = filepath.Join(filepath.Dir(names[0]), "Encrypted") + ".zip"
|
||||||
|
@ -815,7 +815,7 @@ func onDrop(names []string) {
|
||||||
// Decide if encrypting or decrypting
|
// Decide if encrypting or decrypting
|
||||||
if strings.HasSuffix(names[0], ".pcv") || isSplit {
|
if strings.HasSuffix(names[0], ".pcv") || isSplit {
|
||||||
mode = "decrypt"
|
mode = "decrypt"
|
||||||
inputLabel = "Volume for decryption."
|
inputLabel = "Volume for decryption"
|
||||||
startLabel = "Decrypt"
|
startLabel = "Decrypt"
|
||||||
commentsLabel = "Comments (read-only):"
|
commentsLabel = "Comments (read-only):"
|
||||||
commentsDisabled = true
|
commentsDisabled = true
|
||||||
|
@ -863,7 +863,7 @@ func onDrop(names []string) {
|
||||||
if valid, _ := regexp.Match(`^v1\.\d{2}`, tmp); !valid || err != nil {
|
if valid, _ := regexp.Match(`^v1\.\d{2}`, tmp); !valid || err != nil {
|
||||||
// Volume has plausible deniability
|
// Volume has plausible deniability
|
||||||
deniability = true
|
deniability = true
|
||||||
mainStatus = "Can't read header, assuming volume is deniable."
|
mainStatus = "Can't read header, assuming volume is deniable"
|
||||||
fin.Close()
|
fin.Close()
|
||||||
} else {
|
} else {
|
||||||
// Read comments from file and check for corruption
|
// Read comments from file and check for corruption
|
||||||
|
@ -878,13 +878,13 @@ func onDrop(names []string) {
|
||||||
for i := 0; i < commentsLength*3; i += 3 {
|
for i := 0; i < commentsLength*3; i += 3 {
|
||||||
t, err := rsDecode(rs1, tmp[i:i+3])
|
t, err := rsDecode(rs1, tmp[i:i+3])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
comments = "Comments are corrupted."
|
comments = "Comments are corrupted"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
comments += string(t)
|
comments += string(t)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
comments = "Comments are corrupted."
|
comments = "Comments are corrupted"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read flags from file and check for corruption
|
// Read flags from file and check for corruption
|
||||||
|
@ -893,7 +893,7 @@ func onDrop(names []string) {
|
||||||
fin.Close()
|
fin.Close()
|
||||||
flags, err = rsDecode(rs5, flags)
|
flags, err = rsDecode(rs5, flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mainStatus = "The volume header is damaged."
|
mainStatus = "The volume header is damaged"
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -901,9 +901,9 @@ func onDrop(names []string) {
|
||||||
// Update UI and variables according to flags
|
// Update UI and variables according to flags
|
||||||
if flags[1] == 1 {
|
if flags[1] == 1 {
|
||||||
keyfile = true
|
keyfile = true
|
||||||
keyfileLabel = "Keyfiles required."
|
keyfileLabel = "Keyfiles required"
|
||||||
} else {
|
} else {
|
||||||
keyfileLabel = "Not applicable."
|
keyfileLabel = "Not applicable"
|
||||||
}
|
}
|
||||||
if flags[2] == 1 {
|
if flags[2] == 1 {
|
||||||
keyfileOrdered = true
|
keyfileOrdered = true
|
||||||
|
@ -911,7 +911,7 @@ func onDrop(names []string) {
|
||||||
}
|
}
|
||||||
} else { // One file was dropped for encryption
|
} else { // One file was dropped for encryption
|
||||||
mode = "encrypt"
|
mode = "encrypt"
|
||||||
inputLabel = "1 file."
|
inputLabel = "1 file"
|
||||||
startLabel = "Encrypt"
|
startLabel = "Encrypt"
|
||||||
inputFile = names[0]
|
inputFile = names[0]
|
||||||
outputFile = names[0] + ".pcv"
|
outputFile = names[0] + ".pcv"
|
||||||
|
@ -947,18 +947,18 @@ func onDrop(names []string) {
|
||||||
|
|
||||||
// Update UI with the number of files and folders selected
|
// Update UI with the number of files and folders selected
|
||||||
if folders == 0 {
|
if folders == 0 {
|
||||||
inputLabel = fmt.Sprintf("%d files.", files)
|
inputLabel = fmt.Sprintf("%d files", files)
|
||||||
} else if files == 0 {
|
} else if files == 0 {
|
||||||
inputLabel = fmt.Sprintf("%d folders.", folders)
|
inputLabel = fmt.Sprintf("%d folders", folders)
|
||||||
} else {
|
} else {
|
||||||
if files == 1 && folders > 1 {
|
if files == 1 && folders > 1 {
|
||||||
inputLabel = fmt.Sprintf("1 file and %d folders.", folders)
|
inputLabel = fmt.Sprintf("1 file and %d folders", folders)
|
||||||
} else if folders == 1 && files > 1 {
|
} else if folders == 1 && files > 1 {
|
||||||
inputLabel = fmt.Sprintf("%d files and 1 folder.", files)
|
inputLabel = fmt.Sprintf("%d files and 1 folder", files)
|
||||||
} else if folders == 1 && files == 1 {
|
} else if folders == 1 && files == 1 {
|
||||||
inputLabel = "1 file and 1 folder."
|
inputLabel = "1 file and 1 folder"
|
||||||
} else {
|
} else {
|
||||||
inputLabel = fmt.Sprintf("%d files and %d folders.", files, folders)
|
inputLabel = fmt.Sprintf("%d files and %d folders", files, folders)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1111,7 +1111,7 @@ func work() {
|
||||||
// Make sure not to overwrite anything
|
// Make sure not to overwrite anything
|
||||||
_, err := os.Stat(outputFile + ".pcv")
|
_, err := os.Stat(outputFile + ".pcv")
|
||||||
if err == nil { // File already exists
|
if err == nil { // File already exists
|
||||||
mainStatus = "Please remove " + filepath.Base(outputFile+".pcv") + "."
|
mainStatus = "Please remove " + filepath.Base(outputFile+".pcv")
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1242,7 +1242,7 @@ func work() {
|
||||||
if valid, _ := regexp.Match(`^v1\.\d{2}`, tmp); !valid || err != nil {
|
if valid, _ := regexp.Match(`^v1\.\d{2}`, tmp); !valid || err != nil {
|
||||||
os.Remove(inputFile)
|
os.Remove(inputFile)
|
||||||
inputFile = strings.TrimSuffix(inputFile, ".tmp")
|
inputFile = strings.TrimSuffix(inputFile, ".tmp")
|
||||||
broken(nil, nil, "Password is incorrect or the file is not a volume.", true)
|
broken(nil, nil, "Password is incorrect or the file is not a volume", true)
|
||||||
if recombine {
|
if recombine {
|
||||||
inputFile = inputFileOld
|
inputFile = inputFileOld
|
||||||
}
|
}
|
||||||
|
@ -1288,7 +1288,7 @@ func work() {
|
||||||
if len(allFiles) > 1 || len(onlyFolders) > 0 || compress {
|
if len(allFiles) > 1 || len(onlyFolders) > 0 || compress {
|
||||||
os.Remove(inputFile)
|
os.Remove(inputFile)
|
||||||
}
|
}
|
||||||
mainStatus = "Please remove " + filepath.Base(outputFile) + "."
|
mainStatus = "Please remove " + filepath.Base(outputFile)
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1434,7 +1434,7 @@ func work() {
|
||||||
if keep { // If the user chooses to force decrypt
|
if keep { // If the user chooses to force decrypt
|
||||||
kept = true
|
kept = true
|
||||||
} else {
|
} else {
|
||||||
broken(fin, nil, "The volume header is damaged.", true)
|
broken(fin, nil, "The volume header is damaged", true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1571,12 +1571,12 @@ func work() {
|
||||||
kept = true
|
kept = true
|
||||||
} else {
|
} else {
|
||||||
if !keyCorrect {
|
if !keyCorrect {
|
||||||
mainStatus = "The provided password is incorrect."
|
mainStatus = "The provided password is incorrect"
|
||||||
} else {
|
} else {
|
||||||
if keyfileOrdered {
|
if keyfileOrdered {
|
||||||
mainStatus = "Incorrect keyfiles or ordering."
|
mainStatus = "Incorrect keyfiles or ordering"
|
||||||
} else {
|
} else {
|
||||||
mainStatus = "Incorrect keyfiles."
|
mainStatus = "Incorrect keyfiles"
|
||||||
}
|
}
|
||||||
if deniability {
|
if deniability {
|
||||||
fin.Close()
|
fin.Close()
|
||||||
|
@ -1607,7 +1607,7 @@ func work() {
|
||||||
if len(keyfiles) > 0 || keyfile {
|
if len(keyfiles) > 0 || keyfile {
|
||||||
// Prevent an even number of duplicate keyfiles
|
// Prevent an even number of duplicate keyfiles
|
||||||
if bytes.Equal(keyfileKey, make([]byte, 32)) {
|
if bytes.Equal(keyfileKey, make([]byte, 32)) {
|
||||||
mainStatus = "Duplicate keyfiles detected."
|
mainStatus = "Duplicate keyfiles detected"
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
fin.Close()
|
fin.Close()
|
||||||
if len(allFiles) > 1 || len(onlyFolders) > 0 || compress {
|
if len(allFiles) > 1 || len(onlyFolders) > 0 || compress {
|
||||||
|
@ -1716,7 +1716,7 @@ func work() {
|
||||||
if keep {
|
if keep {
|
||||||
kept = true
|
kept = true
|
||||||
} else {
|
} else {
|
||||||
broken(fin, fout, "The input file is irrecoverably damaged.", false)
|
broken(fin, fout, "The input file is irrecoverably damaged", false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1741,7 +1741,7 @@ func work() {
|
||||||
if keep {
|
if keep {
|
||||||
kept = true
|
kept = true
|
||||||
} else {
|
} else {
|
||||||
broken(fin, fout, "The input file is irrecoverably damaged.", false)
|
broken(fin, fout, "The input file is irrecoverably damaged", false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1761,7 @@ func work() {
|
||||||
if keep {
|
if keep {
|
||||||
kept = true
|
kept = true
|
||||||
} else {
|
} else {
|
||||||
broken(fin, fout, "The input file is irrecoverably damaged.", false)
|
broken(fin, fout, "The input file is irrecoverably damaged", false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1856,7 +1856,7 @@ func work() {
|
||||||
if keep {
|
if keep {
|
||||||
kept = true
|
kept = true
|
||||||
} else {
|
} else {
|
||||||
broken(fin, fout, "The input file is damaged or modified.", false)
|
broken(fin, fout, "The input file is damaged or modified", false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2091,17 +2091,17 @@ func work() {
|
||||||
|
|
||||||
// If the user chose to keep a corrupted/modified file, let them know
|
// If the user chose to keep a corrupted/modified file, let them know
|
||||||
if kept {
|
if kept {
|
||||||
mainStatus = "The input file was modified. Please be careful."
|
mainStatus = "The input file was modified. Please be careful"
|
||||||
mainStatusColor = YELLOW
|
mainStatusColor = YELLOW
|
||||||
} else {
|
} else {
|
||||||
mainStatus = "Completed."
|
mainStatus = "Completed"
|
||||||
mainStatusColor = GREEN
|
mainStatusColor = GREEN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the OS denies reading or writing to a file
|
// If the OS denies reading or writing to a file
|
||||||
func accessDenied(s string) {
|
func accessDenied(s string) {
|
||||||
mainStatus = s + " access denied by operating system."
|
mainStatus = s + " access denied by operating system"
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2109,7 +2109,7 @@ func accessDenied(s string) {
|
||||||
func insufficientSpace(fin *os.File, fout *os.File) {
|
func insufficientSpace(fin *os.File, fout *os.File) {
|
||||||
fin.Close()
|
fin.Close()
|
||||||
fout.Close()
|
fout.Close()
|
||||||
mainStatus = "Insufficient disk space."
|
mainStatus = "Insufficient disk space"
|
||||||
mainStatusColor = RED
|
mainStatusColor = RED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2133,7 +2133,7 @@ func broken(fin *os.File, fout *os.File, message string, keepOutput bool) {
|
||||||
func cancel(fin *os.File, fout *os.File) {
|
func cancel(fin *os.File, fout *os.File) {
|
||||||
fin.Close()
|
fin.Close()
|
||||||
fout.Close()
|
fout.Close()
|
||||||
mainStatus = "Operation cancelled by user."
|
mainStatus = "Operation cancelled by user"
|
||||||
mainStatusColor = WHITE
|
mainStatusColor = WHITE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2148,7 +2148,7 @@ func resetUI() {
|
||||||
onlyFiles = nil
|
onlyFiles = nil
|
||||||
onlyFolders = nil
|
onlyFolders = nil
|
||||||
allFiles = nil
|
allFiles = nil
|
||||||
inputLabel = "Drop files and folders into this window."
|
inputLabel = "Drop files and folders into this window"
|
||||||
|
|
||||||
password = ""
|
password = ""
|
||||||
cpassword = ""
|
cpassword = ""
|
||||||
|
@ -2165,7 +2165,7 @@ func resetUI() {
|
||||||
keyfile = false
|
keyfile = false
|
||||||
keyfiles = nil
|
keyfiles = nil
|
||||||
keyfileOrdered = false
|
keyfileOrdered = false
|
||||||
keyfileLabel = "None selected."
|
keyfileLabel = "None selected"
|
||||||
|
|
||||||
comments = ""
|
comments = ""
|
||||||
commentsLabel = "Comments:"
|
commentsLabel = "Comments:"
|
||||||
|
@ -2185,7 +2185,7 @@ func resetUI() {
|
||||||
kept = false
|
kept = false
|
||||||
|
|
||||||
startLabel = "Start"
|
startLabel = "Start"
|
||||||
mainStatus = "Ready."
|
mainStatus = "Ready"
|
||||||
mainStatusColor = WHITE
|
mainStatusColor = WHITE
|
||||||
popupStatus = ""
|
popupStatus = ""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue