wip: update stuff
This commit is contained in:
parent
a3ef08d877
commit
4407f1eb90
47
README.md
47
README.md
@ -26,8 +26,51 @@ If you screenshot a leaderboard, it will check the screenshots folder and try to
|
|||||||
|
|
||||||
|
|
||||||
## Building:
|
## Building:
|
||||||
|
|
||||||
|
#### Windows
|
||||||
```bash
|
```bash
|
||||||
set CGO_ENABLED=0
|
set CGO_ENABLED=0
|
||||||
go build -ldflags="-s -w"
|
go build -ldflags="-s -w"
|
||||||
upx --best --lzma HypixelStuff.exe
|
upx --best --lzma hudly.exe
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Mac (intel x86_64)
|
||||||
|
```bash
|
||||||
|
set GOOS=darwin
|
||||||
|
set GOARCH=amd64
|
||||||
|
set CGO_ENABLED=0
|
||||||
|
go build -ldflags="-s -w"
|
||||||
|
upx --best --lzma --force-macos hudly
|
||||||
|
```
|
||||||
|
NOTE: macOS is currently not supported
|
||||||
|
|
||||||
|
#### Mac (apple silicon ARM)
|
||||||
|
```bash
|
||||||
|
set GOOS=darwin
|
||||||
|
set GOARCH=arm64
|
||||||
|
set CGO_ENABLED=0
|
||||||
|
go build -ldflags="-s -w"
|
||||||
|
upx --best --lzma --force-macos hudly
|
||||||
|
```
|
||||||
|
NOTE: macOS is currently not supported
|
||||||
|
|
||||||
|
|
||||||
|
# TODOS/Limitation
|
||||||
|
- (api_key) Incorrect structure (api headers don't exist if key is invalid) so you get the wrong error code
|
||||||
|
- (build) Requires google's UUID library (too big for my liking)
|
||||||
|
- (client) No keep-alive implemented
|
||||||
|
- (client) No room closure detection
|
||||||
|
- (client) You can't see and send data (sender needs to have 2 clients, 1 to host and 1 to read)
|
||||||
|
- (client/config) Hard coded ip address / port
|
||||||
|
- (config) No Config (hard code key)
|
||||||
|
- (demo) Only in-memory uuid cache
|
||||||
|
- (demo) Lunar Client ONLY (default log location only)
|
||||||
|
- (demo) Requires working key to function
|
||||||
|
- (demo) Windows client sender ONLY (not correct log path locator)
|
||||||
|
- (demo) does NOT show nicked players (doesn't crash)
|
||||||
|
- (gui) Just terminal for now
|
||||||
|
- (hypixel_api) No cache
|
||||||
|
- (player) Only bedwars stats
|
||||||
|
- (server) Terrible status messages
|
||||||
|
- (server/server-config) Hard coded port
|
||||||
|
- (uuid cache) no lifetime (probably isn't needed but still)
|
@ -1,6 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
var key = "ccebff0f-939a-4afe-b5b3-30a7a665ee38"
|
var key = "f6999283-43ba-413e-a04d-32dbde98f423"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var demoApp = NewDemoApp(key)
|
var demoApp = NewDemoApp(key)
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -67,3 +70,45 @@ func GetDefaultConfig() *Config {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveConfig saves the given config struct to the file in JSON format
|
||||||
|
func SaveConfig(config *Config, filePath string) error {
|
||||||
|
// Convert the config struct to JSON
|
||||||
|
data, err := json.MarshalIndent(config, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to serialize config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the JSON data to a file
|
||||||
|
err = ioutil.WriteFile(filePath, data, 0644)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to write config to file: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadConfig loads the config from the given file path
|
||||||
|
func LoadConfig(filePath string) (*Config, error) {
|
||||||
|
// Check if the file exists
|
||||||
|
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||||
|
return nil, fmt.Errorf("config file does not exist: %s", filePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the file content
|
||||||
|
data, err := ioutil.ReadFile(filePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to read config file: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a Config object
|
||||||
|
config := &Config{}
|
||||||
|
|
||||||
|
// Deserialize the JSON data into the Config object
|
||||||
|
err = json.Unmarshal(data, config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to deserialize config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return config, nil
|
||||||
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package hypixel
|
|
||||||
|
|
||||||
func DoThing() int {
|
|
||||||
return 1
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user