Merge pull request #266 from OpenFactorioServerManager/develop

0.10.1 release
This commit is contained in:
knoxfighter 2021-03-09 21:34:07 +01:00 committed by GitHub
commit e95d327526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 7 deletions

View File

@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
## [0.10.1] - 2021-02-10
### Fixed
- Single admin user can no longer be deleted (so there is always a user)
- fixed incompatibility to glibc 2.32 by linking dynamic on linux
- Moved from alpine to ubuntu docker image base, to prevent factorio not running correctly
## [0.10.0] - 2021-02-10
### Added

View File

@ -28,7 +28,7 @@ factorio-server-manager-linux:
@echo "Building Backend - Linux"
@mkdir -p factorio-server-manager
@cd src; \
CGO_ENABLED=1 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -ldflags="-extldflags=-static" -o ../factorio-server-manager/factorio-server-manager .
CGO_ENABLED=1 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -o ../factorio-server-manager/factorio-server-manager .
factorio-server-manager-windows:
@echo "Building Backend - Windows"

View File

@ -1,15 +1,15 @@
# Glibc is required for Factorio Server binaries to run
FROM frolvlad/alpine-glibc
FROM ubuntu
ENV FACTORIO_VERSION=stable \
MANAGER_VERSION=0.10.0 \
MANAGER_VERSION=0.10.1 \
RCON_PASS=""
VOLUME /opt/fsm-data /opt/factorio/saves /opt/factorio/mods /opt/factorio/config
EXPOSE 80/tcp 34197/udp
RUN apk add --no-cache curl tar xz unzip jq
RUN apt-get update && apt-get install -y curl tar xz unzip jq && rm -rf /var/lib/apt/lists/*
WORKDIR /opt

View File

@ -1,5 +1,5 @@
# Glibc is required for Factorio Server binaries to run
FROM frolvlad/alpine-glibc
FROM ubuntu
ENV FACTORIO_VERSION=latest \
RCON_PASS=""
@ -8,7 +8,7 @@ VOLUME /opt/fsm-data /opt/factorio/saves /opt/factorio/mods /opt/factorio/config
EXPOSE 80/tcp 34197/udp
RUN apk add --no-cache curl tar xz unzip jq
RUN apt-get update && apt-get install -y curl tar xz-utils unzip jq && rm -rf /var/lib/apt/lists/*
WORKDIR /opt

View File

@ -2,6 +2,7 @@ package api
import (
"encoding/base64"
"errors"
"log"
"net/http"
@ -102,6 +103,21 @@ func (a *Auth) checkPassword(username, password string) error {
}
func (a *Auth) deleteUser(username string) error {
adminUsers := []User{}
adminQuery := a.db.Find(&User{}).Where(&User{Role: "admin"}).Find(&adminUsers)
if adminQuery.Error != nil {
log.Printf("Error retrieving admin user list from database: %s", adminQuery.Error)
return adminQuery.Error
}
for _, user := range adminUsers {
if user.Username == username {
if adminQuery.RowsAffected == 1 {
return errors.New("cannot delete single admin user")
}
}
}
result := a.db.Model(&User{}).Where(&User{Username: username}).Delete(&User{})
if result.Error != nil {
log.Printf("Error deleting user from database: %s", result.Error)

View File

@ -76,6 +76,7 @@ func CreateSave(filePath string) (string, error) {
cmdOutput, err := exec.Command(config.FactorioBinary, args...).Output()
if err != nil {
log.Printf("Error in creating Factorio save: %s", err)
log.Println(string(cmdOutput))
return "", err
}