diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..2215d080 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: publish + +on: [push] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5b689081..05ab6bca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,19 @@ -FROM php:7-apache +FROM php:8.1-apache RUN rm -rf /var/www/html/* WORKDIR /var/www/html/ # Install Node RUN apt-get update && apt-get -y install curl gnupg -RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - RUN apt-get update && apt-get -y install nodejs # Install PHP modules RUN docker-php-ext-install mysqli # Install Node depdencies -COPY package.json . +COPY package.json . COPY config.env.php config.php RUN npm install # Install PoracleWeb -COPY . . +COPY . . diff --git a/discord_auth.php b/discord_auth.php index 33f2a541..2c3cbbb4 100644 --- a/discord_auth.php +++ b/discord_auth.php @@ -6,6 +6,7 @@ error_reporting(E_ALL); include_once "./config.php"; +include_once "include/defaults.php"; define('OAUTH2_CLIENT_ID', $discordBotClientId); //Your client Id define('OAUTH2_CLIENT_SECRET', $discordBotClientSecret); //Your secret client code @@ -67,7 +68,7 @@ { header("Location: $redirect_url?type=display&page=server_settings"); } - else if ( version_compare($_SESSION['poracleVersion'], @$min_poracle_version) < 0 ) + else if ( version_compare($_SESSION['poracleVersion'], $min_poracle_version) < 0 ) { header("Location: $redirect_url?type=display&page=server_settings"); } diff --git a/docker-compose.example.yml b/docker-compose.example.yml index f2bba93a..f67ea4d6 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -1,27 +1,28 @@ version: '3.1' services: poracle-web: - build: ./poracleWeb # folder or subfolder where poracle-web is located + image: ghcr.io/bbdoc/poracleweb:main container_name: poracle-web restart: unless-stopped tty: true - environment: - PORACLE_DB_HOST: poracle-db - PORACLE_DB_DATABASE: poracledb - PORACLE_DB_USERNAME: poracleuser - PORACLE_DB_PASSWORD: dbPassword - PORACLE_DB_PORT: 3306 - ADMIN_ID: 123456789123456 - REDIRECT_URL: https://poracle.map.com # - DISCORD_BOT_CLIENT_ID: 123456789123456789 - DISCORD_BOT_CLIENT_SECRET: abcdefghijklmnopqrstuvwxyz - MAP_URL: https://tiles.map.com/staticmap/poracle-web?img=https://raw.githubusercontent> - MAP_PORACLE_WEB: https://tiles.map.com/staticmap/poracle-web +# for the configuration you can work with environment variables or bind config.php into container +# environment: +# PORACLE_DB_HOST: poracle-db +# PORACLE_DB_DATABASE: poracledb +# PORACLE_DB_USERNAME: poracleuser +# PORACLE_DB_PASSWORD: dbPassword +# PORACLE_DB_PORT: 3306 +# ADMIN_ID: 123456789123456 +# REDIRECT_URL: https://poracle.map.com # +# DISCORD_BOT_CLIENT_ID: 123456789123456789 +# DISCORD_BOT_CLIENT_SECRET: abcdefghijklmnopqrstuvwxyz +# MAP_URL: https://tiles.map.com/staticmap/poracle-web?img=https://raw.githubusercontent> +# MAP_PORACLE_WEB: https://tiles.map.com/staticmap/poracle-web depends_on: - poracle-db - poracle volumes: - - ./poracle/:/poracle/ +# - ./config.php:/var/www/html/config.php - /etc/localtime:/etc/localtime:ro ports: - 127.0.0.1:9060:80 diff --git a/include/functions.php b/include/functions.php index f9afa9af..58a42267 100644 --- a/include/functions.php +++ b/include/functions.php @@ -356,7 +356,9 @@ function get_gym_color($id) { function set_locale() { global $conn; - $_SESSION['locale'] = $_SESSION['server_locale']; + if (isset($_SESSION['server_locale'])) { + $_SESSION['locale'] = $_SESSION['server_locale']; + } if (isset($_SESSION['id'])) { include_once "./config.php";