fix skins command not properly closing, extra-debug now force enables debug
This commit is contained in:
parent
0576f3ce63
commit
e84b3ea2fe
|
@ -21,4 +21,4 @@ keys.db
|
|||
/public/
|
||||
/builds/
|
||||
|
||||
packets.log.enc
|
||||
packets.log.gpg
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime/debug"
|
||||
|
@ -106,7 +107,34 @@ func main() {
|
|||
}
|
||||
|
||||
if extra_debug {
|
||||
utils.F_Log, err = os.Create("packets.log")
|
||||
utils.G_debug = true
|
||||
|
||||
var log_plain, log_crypt_enc io.WriteCloser = nil, nil
|
||||
|
||||
// open plain text log
|
||||
log_plain, err = os.Create("packets.log")
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
} else {
|
||||
defer log_plain.Close()
|
||||
}
|
||||
|
||||
// open gpg log
|
||||
log_crypt, err := os.Create("packets.log.gpg")
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
} else {
|
||||
defer log_crypt.Close()
|
||||
// encrypter for the log
|
||||
log_crypt_enc, err = crypt.Encer("packets.log", log_crypt)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
} else {
|
||||
defer log_crypt_enc.Close()
|
||||
}
|
||||
}
|
||||
|
||||
utils.F_Log = io.MultiWriter(log_plain, log_crypt_enc)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
|
@ -123,21 +151,6 @@ func main() {
|
|||
|
||||
subcommands.Execute(ctx)
|
||||
|
||||
// encrypt packet log
|
||||
if extra_debug {
|
||||
data, err := os.ReadFile("packets.log")
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
} else {
|
||||
enc, err := crypt.Enc("packets.log", data)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
} else {
|
||||
os.WriteFile("packets.log.enc", enc, 0o755)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if utils.G_interactive {
|
||||
logrus.Info(locale.Loc("enter_to_exit", nil))
|
||||
input := bufio.NewScanner(os.Stdin)
|
||||
|
|
|
@ -16,9 +16,9 @@ report_issue:
|
|||
Vielen Dank!
|
||||
used_extra_debug_report:
|
||||
other: |
|
||||
HINWEIS: Sie haben extra-debug verwendet, welches eine packets.log und eine packets.log.enc Datei erstellt.
|
||||
Bitte laden Sie nur die packets.log.enc Datei hoch, wenn Sie ein Problem melden möchten.
|
||||
packets.log und packets.log.enc können Account-Informationen enthalten (nie Login-Informationen), daher ist es sicherer, die verschlüsselte Datei hochzuladen.
|
||||
HINWEIS: Sie haben extra-debug verwendet, welches eine packets.log und eine packets.log.gpg Datei erstellt.
|
||||
Bitte laden Sie nur die packets.log.gpg Datei hoch, wenn Sie ein Problem melden möchten.
|
||||
packets.log und packets.log.gpg können Account-Informationen enthalten (nie Login-Informationen), daher ist es sicherer, die verschlüsselte Datei hochzuladen.
|
||||
Diese Datei kann von dem Entwickler gelesen werden, aber nicht von Personen, die die öffentlichen Problemseiten ansehen.
|
||||
enter_to_exit:
|
||||
other: "Drücken Sie die Eingabetaste, um das Programm zu beenden."
|
||||
|
@ -30,6 +30,8 @@ preload_packs:
|
|||
other: "Vorladen von Ressourcenpacks für den Proxy"
|
||||
debug_mode:
|
||||
other: "Debug-Modus"
|
||||
refreshed_token:
|
||||
other: Token wurde aktualisiert
|
||||
|
||||
starting_dns:
|
||||
other: "Starten des DNS auf {{.Ip}}:53"
|
||||
|
|
|
@ -16,9 +16,9 @@ report_issue:
|
|||
Thanks!
|
||||
used_extra_debug_report:
|
||||
other: |
|
||||
NOTE: you have used extra-debug which creates a packets.log and a packets.log.enc file
|
||||
please if you want to submit an issue only upload the packets.log.enc file.
|
||||
packets.log and packets.log.enc may include account info (never login info) so it is safer to upload the encrypted file.
|
||||
NOTE: you have used extra-debug which creates a packets.log and a packets.log.gpg file
|
||||
please if you want to submit an issue only upload the packets.log.gpg file.
|
||||
packets.log and packets.log.gpg may include account info (never login info) so it is safer to upload the encrypted file.
|
||||
that file can be read by the developer and not by people looking at the public issues page.
|
||||
enter_to_exit:
|
||||
other: "Press Enter to exit."
|
||||
|
@ -30,6 +30,8 @@ preload_packs:
|
|||
other: "preload resourcepacks for proxy"
|
||||
debug_mode:
|
||||
other: "debug mode"
|
||||
refreshed_token:
|
||||
other: refreshed token
|
||||
|
||||
starting_dns:
|
||||
other: "Starting dns at {{.Ip}}:53"
|
||||
|
|
|
@ -16,9 +16,9 @@ report_issue:
|
|||
Thanks!
|
||||
used_extra_debug_report:
|
||||
other: |
|
||||
NOTE: you have used extra-debug which creates a packets.log and a packets.log.enc file
|
||||
please if you want to submit an issue only upload the packets.log.enc file.
|
||||
packets.log and packets.log.enc may include account info (never login info) so it is safer to upload the encrypted file.
|
||||
NOTE: you have used extra-debug which creates a packets.log and a packets.log.gpg file
|
||||
please if you want to submit an issue only upload the packets.log.gpg file.
|
||||
packets.log and packets.log.gpg may include account info (never login info) so it is safer to upload the encrypted file.
|
||||
that file can be read by the developer and not by people looking at the public issues page.
|
||||
enter_to_exit:
|
||||
other: "Press Entew to exit."
|
||||
|
|
|
@ -301,7 +301,12 @@ func (c *SkinCMD) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}
|
|||
return 1
|
||||
}
|
||||
process_packet_skins(nil, out_path, pk, c.filter, false)
|
||||
if ctx.Err() != nil {
|
||||
serverConn.Close()
|
||||
break
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -3,6 +3,7 @@ package crypt
|
|||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/openpgp"
|
||||
|
@ -39,3 +40,10 @@ func Enc(name string, data []byte) ([]byte, error) {
|
|||
wc.Close()
|
||||
return w.Bytes(), nil
|
||||
}
|
||||
|
||||
func Encer(name string, w io.Writer) (io.WriteCloser, error) {
|
||||
wc, err := openpgp.Encrypt(w, []*openpgp.Entity{recip}, nil, &openpgp.FileHints{
|
||||
IsBinary: true, FileName: name, ModTime: time.Now(),
|
||||
}, nil)
|
||||
return wc, err
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ var MutedPackets = []string{
|
|||
}
|
||||
|
||||
var ExtraVerbose []string
|
||||
var F_Log io.WriteCloser
|
||||
var F_Log io.Writer
|
||||
var dmp_lock sync.Mutex
|
||||
|
||||
func dmp_struct(level int, in any, w_type bool) (s string) {
|
||||
|
|
Loading…
Reference in New Issue