Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vlssu committed Apr 5, 2024
2 parents c332831 + f1c5bbd commit c106a46
Show file tree
Hide file tree
Showing 61 changed files with 4,126 additions and 1,309 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
6 changes: 3 additions & 3 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04]
go: ["1.20.12", "1.21.5"]
go: ["1.21.8", "1.22.1"]
goos: [linux]
goarch: [amd64, arm64]

Expand Down Expand Up @@ -62,14 +62,14 @@ jobs:
- name: Upload Release Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.20.12' }}
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.21.8' }}
with:
name: wings_linux_${{ matrix.goarch }}
path: dist/wings

- name: Upload Debug Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.20.12' }}
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.21.8' }}
with:
name: wings_linux_${{ matrix.goarch }}_debug
path: dist/wings_debug
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.20.12"
go-version: "1.21.8"

- name: Build release binaries
env:
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## v1.11.11
### Fixed
* Backups missing content when a `.pteroignore` file is used
* Archives originating from a subdirectory not containing any files ([#5030](https://github.com/pterodactyl/panel/issues/5030))

## v1.11.10
### Fixed
* Archives randomly ignoring files and directories ([#5027](https://github.com/pterodactyl/panel/issues/5027))
* Crash when deleting or transferring a server ([#5028](https://github.com/pterodactyl/panel/issues/5028))

## v1.11.9
### Changed
* Release binaries are now built with Go 1.21.8
* Updated Go dependencies

### Fixed
* [CVE-2024-27102](https://www.cve.org/CVERecord?id=CVE-2024-27102)

## v1.11.8
### Changed
* Release binaries are now built with Go 1.20.10 (resolves [CVE-2023-44487](https://www.cve.org/CVERecord?id=CVE-2023-44487))
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1 (Build)
FROM golang:1.20.12-alpine AS builder
FROM golang:1.21.8-alpine AS builder

ARG VERSION
RUN apk add --update --no-cache git make
Expand Down
35 changes: 35 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"regexp"
"strings"
"sync"
"sync/atomic"
"text/template"
"time"

Expand All @@ -20,6 +21,7 @@ import (
"github.com/apex/log"
"github.com/creasty/defaults"
"github.com/gbrlsnchs/jwt/v3"
"golang.org/x/sys/unix"
"gopkg.in/yaml.v2"

"github.com/pterodactyl/wings/system"
Expand Down Expand Up @@ -209,6 +211,8 @@ type SystemConfiguration struct {
Backups Backups `yaml:"backups"`

Transfers Transfers `yaml:"transfers"`

OpenatMode string `default:"auto" yaml:"openat_mode"`
}

type CrashDetection struct {
Expand Down Expand Up @@ -671,3 +675,34 @@ func getSystemName() (string, error) {
}
return release["ID"], nil
}

var openat2 atomic.Bool
var openat2Set atomic.Bool

func UseOpenat2() bool {
if openat2Set.Load() {
return openat2.Load()
}
defer openat2Set.Store(true)

c := Get()
openatMode := c.System.OpenatMode
switch openatMode {
case "openat2":
openat2.Store(true)
return true
case "openat":
openat2.Store(false)
return false
default:
fd, err := unix.Openat2(unix.AT_FDCWD, "/", &unix.OpenHow{})
if err != nil {
log.WithError(err).Warn("error occurred while checking for openat2 support, falling back to openat")
openat2.Store(false)
return false
}
_ = unix.Close(fd)
openat2.Store(true)
return true
}
}
4 changes: 2 additions & 2 deletions config/config_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/base64"
"sort"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/registry"
"github.com/goccy/go-json"
)

Expand Down Expand Up @@ -115,7 +115,7 @@ type RegistryConfiguration struct {
// Base64 returns the authentication for a given registry as a base64 encoded
// string value.
func (c RegistryConfiguration) Base64() (string, error) {
b, err := json.Marshal(types.AuthConfig{
b, err := json.Marshal(registry.AuthConfig{
Username: c.Username,
Password: c.Password,
})
Expand Down
85 changes: 85 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
description = "Wings";

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {...} @ inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"];

imports = [
inputs.treefmt-nix.flakeModule
];

perSystem = {system, ...}: let
pkgs = import inputs.nixpkgs {inherit system;};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go_1_22
gofumpt
golangci-lint
gotools
];
};

treefmt = {
projectRootFile = "flake.nix";

programs = {
alejandra.enable = true;
deadnix.enable = true;
gofumpt = {
enable = true;
extra = true;
};
shellcheck.enable = true;
shfmt = {
enable = true;
indent_size = 0; # 0 causes shfmt to use tabs
};
yamlfmt.enable = true;
};
};
};
};
}
Loading

0 comments on commit c106a46

Please sign in to comment.