diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 17ab03b..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -# Update the VARIANT arg in docker-compose.yml to pick a PHP version: 8, 8.0, 8.1 -ARG VARIANT=8 -FROM mcr.microsoft.com/devcontainers/php:${VARIANT} - -# Install packages -RUN set -ex; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - sqlite3 \ - ; \ - rm -rf /var/lib/apt/lists/* - -# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user. -ARG USER_UID=1000 -ARG USER_GID=$USER_UID -RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \ - groupmod --gid $USER_GID vscode \ - && usermod --uid $USER_UID --gid $USER_GID vscode \ - && chmod -R $USER_UID:$USER_GID /home/vscode \ - && chmod -R $USER_UID:root /usr/local/share/nvm; \ - fi - -# [Optional] Install a version of Node.js using nvm for front end dev -ARG INSTALL_NODE="true" -ARG NODE_VERSION="lts/*" -RUN if [ "${INSTALL_NODE}" = "true" ]; then bash -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION}"; fi - -# [Optional] Uncomment this section to install additional OS packages. -RUN set -ex; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libicu-dev \ - zlib1g-dev \ - libzip-dev \ - libpq-dev \ - libgmp-dev \ - ; \ - \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ - docker-php-ext-configure intl; \ - docker-php-ext-configure gmp; \ - docker-php-ext-install -j$(nproc) \ - intl \ - zip \ - bcmath \ - gmp \ - ; \ - \ - rm -rf /var/lib/apt/lists/* - -# [Optional] Uncomment this line to install global node packages. -RUN npm install -g --unsafe-perm yarn diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5d2ab37..c03d0b7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,16 +1,14 @@ { "name": "PHP & SQLite", - "service": "app", - "workspaceFolder": "/workspace", - "dockerComposeFile": "docker-compose.yml", + "image": "ghcr.io/asbiin/devcontainers/php:8.2", // For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start) "forwardPorts": [8080], + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": ".devcontainer/postCreate.sh", "postStartCommand": ".devcontainer/postStart.sh" - - // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. - // "remoteUser": "vscode" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index e20881d..0000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: '3' - -services: - app: - build: - context: . - dockerfile: Dockerfile - args: - VARIANT: '8.2' - # [Option] Install Node.js - INSTALL_NODE: 'true' - NODE_VERSION: 'lts/*' - # On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000. - USER_UID: 1000 - USER_GID: 1000 - - volumes: - - ..:/workspace:cached - - # Overrides default command so things don't shut down after the process ends. - command: sleep infinity diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 4486184..bb5f462 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -31,7 +31,7 @@ set_apache() { } set_database() { - cp $ROOT/.env.example $ROOT/.env && echo "APP_TRUSTED_PROXIES=*" >> $ROOT/.env + cp $ROOT/.env.example $ROOT/.env && echo -e "APP_TRUSTED_PROXIES=*\nAPP_FORCE_URL=true" >> $ROOT/.env setenv "DB_CONNECTION" "sqlite" setenv "DB_DATABASE" "$ROOT/$DATABASE" touch $ROOT/$DATABASE && chgrp www-data $ROOT/$DATABASE && chmod g+w $ROOT/$DATABASE diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 69ffade..93f038f 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -5,8 +5,11 @@ use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; +use Illuminate\Support\Facades\URL; +use Illuminate\Support\Str; class RouteServiceProvider extends ServiceProvider { @@ -24,6 +27,11 @@ class RouteServiceProvider extends ServiceProvider */ public function boot(): void { + if (Config::get('app.force_url')) { + URL::forceRootUrl(Str::of(config('app.url'))->ltrim('/')); + URL::forceScheme('https'); + } + RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); diff --git a/config/app.php b/config/app.php index b8d8cb8..2b734cc 100644 --- a/config/app.php +++ b/config/app.php @@ -59,6 +59,8 @@ 'asset_url' => env('ASSET_URL'), + 'force_url' => (bool) env('APP_FORCE_URL', false), + /* |-------------------------------------------------------------------------- | Application Timezone diff --git a/resources/css/app.css b/resources/css/app.css index 547f4f9..7ce3903 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,3 +1,4 @@ +@import 'charts.css'; @tailwind base; @tailwind components; @tailwind utilities; diff --git a/resources/js/app.js b/resources/js/app.js index e22d0c2..0c759a7 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,9 +1,9 @@ import './bootstrap'; +import '../css/app.css'; import Alpine from 'alpinejs'; import Clipboard from "@ryangjchandler/alpine-clipboard"; import htmx from 'htmx.org'; -import 'charts.css'; window.Alpine = Alpine; window.htmx = htmx; diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 6da4035..574ed32 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -11,7 +11,7 @@ - @vite(['resources/css/app.css', 'resources/js/app.js']) + @vite('resources/js/app.js')
diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php index dc35bb9..adbece7 100644 --- a/resources/views/layouts/guest.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -10,7 +10,7 @@