Skip to content

Commit

Permalink
Add nixos module and bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
BatteredBunny committed Apr 4, 2024
1 parent a752732 commit 6dda26d
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 65 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,46 @@
This is needed as browser itself can't do many of the requests to roblox so a proxy of sorts is needed.

# Recommended usage
The recommended way to use this is to use the docker image, check the [docker-compose.yml](https://github.com/BatteredBunny/roblox-account-value-api/blob/master/docker-compose.yml) in the repo :)
The recommended way to use this is to use the nixos module, though there is a docker image with docker-compose.yml as well.

# Building docker image with nix
```
nix run github:BatteredBunny/roblox-account-value-api#docker.copyToDockerDaemon
```

# Running as service on nixos
```nix
# flake.nix
inputs = {
roblox-account-value-api.url = "github:BatteredBunny/roblox-account-value-api";
};
```

```nix
# configuration.nix
imports = [
inputs.roblox-account-value-api.nixosModules.${builtins.currentSystem}.default
];
services.roblox-account-value-api = {
enable = true;
settings.port = 8080;
# Optional parameters
package = inputs.roblox-account-value-api.packages.${builtins.currentSystem}.default;
settings.robux_per_euro = 60;
};
```

# Building standalone program with nix
```
nix build github:BatteredBunny/roblox-account-value-api
```


# API
Handy info for utilizing the api yourself
## Account collectibles value API

```
GET https://roblox-account-value-api.sly.ee/api/collectibles-account-value?userid=XXX
{
Expand Down Expand Up @@ -53,6 +77,7 @@ GET https://roblox-account-value-api.sly.ee/api/profile-info?userid=XXX
```

## Exchange Rate API
Used for calculating currency value
```
GET https://roblox-account-value-api.sly.ee/api/exchange-rate
{
Expand Down
2 changes: 1 addition & 1 deletion build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildGoModule rec {
src = ./.;

name = "roblox-account-value-api";
vendorHash = "sha256-++ocAIm+8xt7xYU5ZCVOaKt0zvROR0/jSb4623M6/d0=";
vendorHash = "sha256-KHJrIQ9eGBLQUFOORy4iM1gdiLR+g3k3HDs3KlRiErE=";

ldflags = [
"-s"
Expand Down
9 changes: 5 additions & 4 deletions docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
nix2container,
lib,
}: let
config = pkgs.writeText "config.toml" ''
port = "80"
robux_per_euro = 60
'';
toml = pkgs.formats.toml {};
config = toml.generate "config.toml" {
port = "80";
robux_per_euro = 60;
};
in
nix2container.packages.${pkgs.system}.nix2container.buildImage {
name = "ghcr.io/batteredbunny/roblox-account-value-api";
Expand Down
5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
};

outputs = {
self,
nixpkgs,
flake-utils,
nix2container,
...
}:
} @ inputs:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
Expand All @@ -24,6 +25,8 @@
else pkgs.pkgsCross."${pkgs.stdenv.hostPlatform.uname.processor}-multiplatform".callPackage;
in
with pkgs; {
nixosModules.default = import ./module.nix inputs;

devShells.default = mkShell {
buildInputs = [
gnumake
Expand Down
37 changes: 19 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
module github.com/BatteredBunny/roblox-account-value-api

go 1.21
go 1.22

require (
github.com/BurntSushi/toml v1.3.2
github.com/didip/tollbooth/v7 v7.0.1
github.com/gin-gonic/gin v1.9.1
github.com/google/wire v0.5.0
github.com/google/wire v0.6.0
)

require (
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-pkgz/expirable-cache v0.1.0 // indirect
github.com/go-pkgz/expirable-cache v1.0.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 6dda26d

Please sign in to comment.