fix accidental includes, some settings not showing
This commit is contained in:
parent
f643e59e3f
commit
5565301f11
|
@ -1 +1 @@
|
|||
utils/resourcepack-ace.go filter=git-crypt diff=git-crypt
|
||||
subcommands/resourcepack-d/resourcepack-d.go filter=git-crypt diff=git-crypt
|
16
build.py
16
build.py
|
@ -12,8 +12,8 @@ VER = VER_RE.match(TAG).group(1)
|
|||
CI = not not os.getenv("GITLAB_CI")
|
||||
|
||||
|
||||
with open("./utils/resourcepack-ace.go", "rb") as f:
|
||||
PACK_SUPPORT = f.read(7) == b"package"
|
||||
with open("./subcommands/resourcepack-d/resourcepack-d.go", "rb") as f:
|
||||
PACK_SUPPORT = f.read(100).count(b"package ") > 0
|
||||
|
||||
print(f"Pack Support: {PACK_SUPPORT}")
|
||||
|
||||
|
@ -21,7 +21,7 @@ LDFLAGS = f"-s -w -X github.com/bedrock-tool/bedrocktool/utils.Version={TAG}"
|
|||
|
||||
PLATFORMS = [
|
||||
("windows", ["386", "amd64"], ".exe"),
|
||||
("linux", ["386", "amd64", "arm", "arm64"], ""),
|
||||
("linux", ["386", "amd64", "arm64"], ""),
|
||||
#("darwin", ["amd64", "arm64"], ""),
|
||||
("android", ["arm64"], ".apk")
|
||||
]
|
||||
|
@ -60,21 +60,19 @@ for (platform_name, archs, ext) in PLATFORMS:
|
|||
SUB1 = '-gui' if GUI else ''
|
||||
name = f"{NAME}{SUB1}"
|
||||
|
||||
tags = []
|
||||
env = ["GOVCS=*:off"]
|
||||
GOFLAGS = []
|
||||
if not PACK_SUPPORT:
|
||||
GOFLAGS.append("-overlay=overlay.json")
|
||||
tags.append("nopacks")
|
||||
|
||||
if GUI:
|
||||
if len(GOFLAGS):
|
||||
env.append(f"GOFLAGS={' '.join(GOFLAGS)}")
|
||||
args = [
|
||||
"fyne-cross", platform_name,
|
||||
"-app-version", VER,
|
||||
"-arch", ",".join(archs),
|
||||
"-ldflags", LDFLAGS + f" -X github.com/bedrock-tool/bedrocktool/utils.CmdName=bedrocktool-gui",
|
||||
"-name", name,
|
||||
"-tags", "gui",
|
||||
"-tags", ",".join(["gui"] + tags),
|
||||
"-debug"
|
||||
]
|
||||
for e in env:
|
||||
|
@ -96,10 +94,10 @@ for (platform_name, archs, ext) in PLATFORMS:
|
|||
"go", "build",
|
||||
"-ldflags", LDFLAGS,
|
||||
"-trimpath",
|
||||
"-tags", ",".join(tags),
|
||||
"-v",
|
||||
"-o", out_path,
|
||||
]
|
||||
args.extend(GOFLAGS)
|
||||
args.append("./cmd/bedrocktool")
|
||||
print(args)
|
||||
out = subprocess.run(args)
|
||||
|
|
|
@ -232,14 +232,6 @@ func (c *CreateCustomDataCMD) Execute(_ context.Context, f *flag.FlagSet, _ ...i
|
|||
return 0
|
||||
}
|
||||
|
||||
func (c *TransCMD) MainWindow() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CreateCustomDataCMD) MainWindow() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
utils.RegisterCommand(&TransCMD{})
|
||||
utils.RegisterCommand(&CreateCustomDataCMD{})
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"Replace": {
|
||||
"utils/resourcepack-ace.go": "utils/dummy"
|
||||
}
|
||||
}
|
|
@ -7,8 +7,6 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"fyne.io/fyne/v2/data/binding"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/bedrock-tool/bedrocktool/locale"
|
||||
"github.com/bedrock-tool/bedrocktool/utils"
|
||||
|
||||
|
@ -30,19 +28,6 @@ func (c *ChatLogCMD) SetFlags(f *flag.FlagSet) {
|
|||
f.BoolVar(&c.Verbose, "v", false, "verbose")
|
||||
}
|
||||
|
||||
func (c *ChatLogCMD) SettingsUI() *widget.Form {
|
||||
return widget.NewForm(
|
||||
widget.NewFormItem(
|
||||
"serverAddress", widget.NewEntryWithData(binding.BindString(&c.ServerAddress)),
|
||||
), widget.NewFormItem(
|
||||
"", widget.NewCheckWithData("verbose", binding.BindBool(&c.Verbose)),
|
||||
),
|
||||
)
|
||||
}
|
||||
func (c *ChatLogCMD) MainWindow() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ChatLogCMD) Usage() string {
|
||||
return c.Name() + ": " + c.Synopsis() + "\n" + locale.Loc("server_address_help", nil)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
//go:build !nopacks
|
||||
|
||||
package subcommands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
|
||||
"github.com/bedrock-tool/bedrocktool/locale"
|
||||
resourcepackd "github.com/bedrock-tool/bedrocktool/subcommands/resourcepack-d"
|
||||
"github.com/bedrock-tool/bedrocktool/utils"
|
||||
"github.com/google/subcommands"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// decrypt using cfb with segmentsize = 1
|
||||
|
||||
type ResourcePackCMD struct {
|
||||
ServerAddress string
|
||||
SaveEncrypted bool
|
||||
OnlyKeys bool
|
||||
}
|
||||
|
||||
func (*ResourcePackCMD) Name() string { return "packs" }
|
||||
func (*ResourcePackCMD) Synopsis() string { return locale.Loc("pack_synopsis", nil) }
|
||||
|
||||
func (c *ResourcePackCMD) SetFlags(f *flag.FlagSet) {
|
||||
f.StringVar(&c.ServerAddress, "address", "", locale.Loc("remote_address", nil))
|
||||
f.BoolVar(&c.SaveEncrypted, "save-encrypted", false, locale.Loc("save_encrypted", nil))
|
||||
f.BoolVar(&c.OnlyKeys, "only-keys", false, locale.Loc("only_keys", nil))
|
||||
}
|
||||
|
||||
func (c *ResourcePackCMD) Usage() string {
|
||||
return c.Name() + ": " + c.Synopsis() + "\n" + locale.Loc("server_address_help", nil)
|
||||
}
|
||||
|
||||
func (c *ResourcePackCMD) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
err := resourcepackd.Execute_cmd(ctx, c.ServerAddress, c.OnlyKeys, c.SaveEncrypted)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
utils.RegisterCommand(&ResourcePackCMD{})
|
||||
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
//go:build nopacks
|
||||
|
||||
package subcommands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
|
||||
"github.com/bedrock-tool/bedrocktool/utils"
|
||||
"github.com/google/subcommands"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type ResourcePackCMD struct {
|
||||
ServerAddress string
|
||||
SaveEncrypted bool
|
||||
OnlyKeys bool
|
||||
}
|
||||
|
||||
func (*ResourcePackCMD) Name() string { return "packs" }
|
||||
func (*ResourcePackCMD) Synopsis() string { return "NOT COMPILED" }
|
||||
|
||||
func (c *ResourcePackCMD) SetFlags(f *flag.FlagSet) {}
|
||||
|
||||
func (c *ResourcePackCMD) Usage() string {
|
||||
return c.Name() + ": " + c.Synopsis()
|
||||
}
|
||||
|
||||
func (c *ResourcePackCMD) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
logrus.Error("not compiled")
|
||||
return 1
|
||||
}
|
||||
|
||||
func init() {
|
||||
utils.RegisterCommand(&ResourcePackCMD{})
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
//go:build gui || android
|
||||
//go:build gui || android || true
|
||||
|
||||
package gui
|
||||
|
||||
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
var settings = map[string]func(utils.Command) *widget.Form{
|
||||
"world": func(cc utils.Command) *widget.Form {
|
||||
"worlds": func(cc utils.Command) *widget.Form {
|
||||
c := cc.(*world.WorldCMD)
|
||||
return widget.NewForm(
|
||||
widget.NewFormItem(
|
||||
|
@ -71,6 +71,18 @@ var settings = map[string]func(utils.Command) *widget.Form{
|
|||
),
|
||||
)
|
||||
},
|
||||
"packs": func(cc utils.Command) *widget.Form {
|
||||
c := cc.(*subcommands.ResourcePackCMD)
|
||||
return widget.NewForm(
|
||||
widget.NewFormItem(
|
||||
"serverAddress", widget.NewEntryWithData(binding.BindString(&c.ServerAddress)),
|
||||
), widget.NewFormItem(
|
||||
"", widget.NewCheckWithData("saveEncrypted", binding.BindBool(&c.SaveEncrypted)),
|
||||
), widget.NewFormItem(
|
||||
"", widget.NewCheckWithData("only-keys", binding.BindBool(&c.OnlyKeys)),
|
||||
),
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
type GUI struct {
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/bedrock-tool/bedrocktool/locale"
|
||||
"github.com/google/subcommands"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -40,14 +39,6 @@ func (*RealmListCMD) Synopsis() string { return locale.Loc("list_realms_synopsis
|
|||
|
||||
func (c *RealmListCMD) SetFlags(f *flag.FlagSet) {}
|
||||
|
||||
func (c *RealmListCMD) SettingsUI() *widget.Form {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *RealmListCMD) MainWindow() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *RealmListCMD) Usage() string {
|
||||
return c.Name() + ": " + c.Synopsis() + "\n"
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -4,6 +4,7 @@ package utils
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/aes"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
@ -177,3 +178,20 @@ func WriteManifest(manifest *resource.Manifest, fpath string) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CfbDecrypt(data []byte, key []byte) ([]byte, error) {
|
||||
cipher, err := aes.NewCipher([]byte(key))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
shiftRegister := append(key[:16], data...)
|
||||
iv := make([]byte, 16)
|
||||
off := 0
|
||||
for ; off < len(data); off += 1 {
|
||||
cipher.Encrypt(iv, shiftRegister)
|
||||
data[off] ^= iv[0]
|
||||
shiftRegister = shiftRegister[1:]
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue