Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbb7c1c0fc
|
||
|
|
410bba4966
|
||
|
|
17aee22400
|
||
|
|
aaf220dce2
|
||
|
|
276a289ca7
|
||
|
|
e684365612
|
||
|
|
105cc96963
|
||
|
|
bdd62aadf5
|
||
|
|
390c13608a
|
||
|
|
345cf31bb3
|
||
|
|
c7f5ea0d85
|
||
|
|
fc6141e2b9
|
||
|
|
5049a01d2a
|
||
|
|
45d0c9fa80
|
||
|
|
1e4b982430
|
||
|
|
0a7d248a3e
|
||
|
|
2177dfd893
|
||
|
|
173b50fa6c
|
||
|
|
d7338b84d3
|
||
|
|
0216861579
|
No files matched your search
Vendored
+27
-8
@@ -62,23 +62,42 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Release Docker image') {
|
||||
stage('Prepare Docker release') {
|
||||
environment {
|
||||
COMPOSER_HOME="${WORKSPACE}/.composer"
|
||||
npm_config_cache="${WORKSPACE}/.npm"
|
||||
}
|
||||
agent {
|
||||
dockerfile {
|
||||
filename 'docker/Dockerfile'
|
||||
dir '.'
|
||||
additionalBuildArgs '--target mapg_base'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sh script: 'git clean -ffdx', label: 'Clean repository'
|
||||
env.VERSION = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim()
|
||||
sh script: 'docker/scripts/release.sh', label: 'Release script'
|
||||
sh script: "rm -rf ${env.COMPOSER_HOME} ${env.npm_config_cache}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def version = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim()
|
||||
def imageUrl = "git.esoko.eu/esoko/mapguesser:${version}"
|
||||
|
||||
stage('Release Docker image') {
|
||||
steps {
|
||||
script {
|
||||
withDockerRegistry([credentialsId: 'gitea-system-user', url: 'https://git.esoko.eu/']) {
|
||||
sh script: 'docker buildx create --use --bootstrap --platform=linux/arm64,linux/amd64 --name multi-platform-builder'
|
||||
sh script: """docker buildx build \
|
||||
-t ${imageUrl} \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f docker/Dockerfile \
|
||||
--target mapg_release \
|
||||
-t git.esoko.eu/esoko/mapguesser:${env.VERSION} \
|
||||
--push \
|
||||
.""",
|
||||
label: 'Build Docker image'
|
||||
|
||||
withDockerRegistry([credentialsId: 'gitea-system-user', url: 'https://git.esoko.eu/']) {
|
||||
sh script: "docker push ${imageUrl}", label: 'Push Docker image to registry'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"esoko/soko-web": "0.14",
|
||||
"esoko/soko-web": "0.14.1",
|
||||
"fzaninotto/faker": "^1.9"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
Generated
+4
-4
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "00d7fdf2ffefd95b3379f5eb8305c288",
|
||||
"content-hash": "c2d311e92faa5e080b0da454491ab6ea",
|
||||
"packages": [
|
||||
{
|
||||
"name": "cocur/slugify",
|
||||
@@ -82,11 +82,11 @@
|
||||
},
|
||||
{
|
||||
"name": "esoko/soko-web",
|
||||
"version": "v0.14",
|
||||
"version": "v0.14.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.esoko.eu/esoko/soko-web.git",
|
||||
"reference": "ebe1fa2aa625c9035611bd995539e9d0f87d1e08"
|
||||
"reference": "7210b24aa31f47a55125a7c1f74267313f372559"
|
||||
},
|
||||
"require": {
|
||||
"cocur/slugify": "^4.3",
|
||||
@@ -108,7 +108,7 @@
|
||||
"GNU GPL 3.0"
|
||||
],
|
||||
"description": "Lightweight web framework",
|
||||
"time": "2023-09-16T21:56:41+00:00"
|
||||
"time": "2023-09-26T22:26:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<?php //empty on purpose
|
||||
+3
-3
@@ -2,7 +2,7 @@ FROM ubuntu:focal AS mapg_base
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt update --fix-missing && apt install -y curl git unzip mariadb-client nginx \
|
||||
RUN apt update --fix-missing && apt install -y sudo curl git unzip mariadb-client nginx \
|
||||
php-apcu php7.4-cli php7.4-curl php7.4-fpm php7.4-mbstring php7.4-mysql php7.4-zip php7.4-xml
|
||||
|
||||
RUN mkdir -p /run/php
|
||||
@@ -30,14 +30,14 @@ EXPOSE 8090
|
||||
EXPOSE 9229
|
||||
ENTRYPOINT docker/scripts/entry-point-dev.sh
|
||||
|
||||
|
||||
FROM mapg_base AS mapg_release
|
||||
|
||||
RUN apt update --fix-missing && apt install -y cron
|
||||
|
||||
WORKDIR /var/www/mapguesser
|
||||
COPY ./ /var/www/mapguesser
|
||||
RUN docker/scripts/release.sh &&\
|
||||
rm -rf /var/www/mapguesser/.git /var/www/mapguesser/.env
|
||||
RUN rm -rf /var/www/mapguesser/.git
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 8090
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
chmod 777 cache
|
||||
|
||||
echo "Installing Composer packages..."
|
||||
if [ -f .env ]; then
|
||||
composer install
|
||||
@@ -20,11 +18,18 @@ echo "Installing Yarn packages..."
|
||||
echo "Migrating DB..."
|
||||
./mapg db:migrate
|
||||
|
||||
echo "Set runner user based on owner of .env..."
|
||||
USER_UID=$(stat -c "%u" .env)
|
||||
USER_GID=$(stat -c "%g" .env)
|
||||
groupadd --gid $USER_GID mapg
|
||||
useradd --uid $USER_UID --gid $USER_GID mapg
|
||||
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/7.4/fpm/pool.d/www.conf
|
||||
|
||||
set +e
|
||||
|
||||
/usr/sbin/php-fpm7.4 -F &
|
||||
/usr/sbin/nginx -g 'daemon off;' &
|
||||
/usr/bin/node --inspect=0.0.0.0:9229 multi &
|
||||
sudo -u mapg -g mapg /usr/bin/node --inspect=0.0.0.0:9229 multi &
|
||||
|
||||
wait -n
|
||||
|
||||
|
||||
@@ -8,12 +8,20 @@ echo "Migrating DB..."
|
||||
echo "Installing crontab..."
|
||||
/usr/bin/crontab docker/scripts/cron
|
||||
|
||||
echo "Set runner user based on owner of .env..."
|
||||
USER_UID=$(stat -c "%u" .env)
|
||||
USER_GID=$(stat -c "%g" .env)
|
||||
groupadd --gid $USER_GID mapg
|
||||
useradd --uid $USER_UID --gid $USER_GID mapg
|
||||
chown mapg:mapg cache
|
||||
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/7.4/fpm/pool.d/www.conf
|
||||
|
||||
set +e
|
||||
|
||||
/usr/sbin/cron -f &
|
||||
/usr/sbin/php-fpm7.4 -F &
|
||||
/usr/sbin/nginx -g 'daemon off;' &
|
||||
/usr/bin/node multi &
|
||||
sudo -u mapg -g mapg /usr/bin/node multi &
|
||||
|
||||
wait -n
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
chmod 777 cache
|
||||
|
||||
echo "Installing Composer packages..."
|
||||
composer create-project --no-dev
|
||||
|
||||
@@ -28,3 +26,5 @@ find public/static/img -type f -iname '*.svg' -exec svgo {} -o {} \;
|
||||
|
||||
echo "Linking view files..."
|
||||
./mapg view:link
|
||||
|
||||
rm .env
|
||||
Generated
+31
-5
@@ -1,17 +1,43 @@
|
||||
{
|
||||
"name": "mapguesser-multi",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mapguesser-multi",
|
||||
"license": "GNU AGPL 3.0",
|
||||
"dependencies": {
|
||||
"dotenv": {
|
||||
"dotenv": "^8.2.0",
|
||||
"ws": "^7.4.4"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"node_modules/ws": {
|
||||
"version": "7.4.4",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz",
|
||||
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw=="
|
||||
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==",
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,7 +376,7 @@ header>p>span {
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
header>p>span>a:link, header>p>span>a:visited {
|
||||
header>p>span>a:link, header>p>span>a:visited, footer>p>a:link, footer>p>a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,13 +81,11 @@ class LoginController
|
||||
|
||||
if (\Container::$request->session()->has('tmp_user_data')) {
|
||||
$tmpUserData = \Container::$request->session()->get('tmp_user_data');
|
||||
|
||||
$data = ['email' => $tmpUserData['email']];
|
||||
} else {
|
||||
$data = [];
|
||||
$tmpUserData = [];
|
||||
}
|
||||
|
||||
return new HtmlContent('login/signup', $data);
|
||||
return new HtmlContent('login/signup', $tmpUserData);
|
||||
}
|
||||
|
||||
public function getSignupSuccess()
|
||||
@@ -159,6 +157,13 @@ class LoginController
|
||||
return new JsonContent(['success' => true]);
|
||||
}
|
||||
|
||||
if (
|
||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
||||
) {
|
||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||
|
||||
if ($user === null) {
|
||||
@@ -173,10 +178,14 @@ class LoginController
|
||||
$tmpUser = new User();
|
||||
$tmpUser->setPlainPassword(\Container::$request->post('password'));
|
||||
|
||||
\Container::$request->session()->set('tmp_user_data', [
|
||||
'email' => \Container::$request->post('email'),
|
||||
'password_hashed' => $tmpUser->getPassword()
|
||||
]);
|
||||
$tmpUserData = ['password_hashed' => $tmpUser->getPassword()];
|
||||
if (filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false) {
|
||||
$tmpUserData['username'] = \Container::$request->post('email');
|
||||
} else {
|
||||
$tmpUserData['email'] = \Container::$request->post('email');
|
||||
}
|
||||
|
||||
\Container::$request->session()->set('tmp_user_data', $tmpUserData);
|
||||
|
||||
return new JsonContent([
|
||||
'redirect' => [
|
||||
@@ -498,6 +507,13 @@ class LoginController
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
||||
) {
|
||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||
|
||||
if ($user === null) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<h2>Login</h2>
|
||||
<div class="box">
|
||||
<form id="loginForm" action="/login" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
|
||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" required autofocus>
|
||||
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" required autofocus>
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="current-password" required minlength="6">
|
||||
<p id="loginFormError" class="formError justify marginTop"></p>
|
||||
<div class="right marginTop">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<h2>Request password reset</h2>
|
||||
<div class="box">
|
||||
<form id="passwordResetForm" action="/password/requestReset" method="post" data-redirect-on-success="/password/requestReset/success">
|
||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" value="<?= isset($email) ? $email : '' ?>" required autofocus>
|
||||
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" value="<?= isset($email) ? $email : '' ?>" required autofocus>
|
||||
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
||||
<div class="marginTop">
|
||||
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
||||
|
||||
+12
-3
@@ -7,16 +7,25 @@
|
||||
<h2>Sign up</h2>
|
||||
<div class="box">
|
||||
<form id="signupForm" action="/signup" method="post" data-redirect-on-success="/signup/success">
|
||||
<?php if (isset($email)): ?>
|
||||
<?php if (isset($email) || isset($username)): ?>
|
||||
<p class="justify">No user found with the given email address / username. Sign up with one click!</p>
|
||||
<?php if (isset($email)): ?>
|
||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" value="<?= $email ?>" required>
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password confirmation" autocomplete="new-password" required minlength="6" autofocus>
|
||||
<?php else: ?>
|
||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($username)): ?>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" value="<?= $username ?>">
|
||||
<?php else: ?>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" autofocus>
|
||||
<?php endif; ?>
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password confirmation" autocomplete="new-password" required minlength="6">
|
||||
<?php else: ?>
|
||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username">
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="new-password" required minlength="6">
|
||||
<input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" autocomplete="new-password" minlength="6">
|
||||
<?php endif; ?>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username">
|
||||
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
||||
<div class="marginTop">
|
||||
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
</main>
|
||||
<footer>
|
||||
<p><span class="bold"><?= $_ENV['APP_NAME'] ?></span> <?= str_replace('Release_', '', VERSION) ?></p><!--
|
||||
--><p>© The MapGuesser Contributors <?= (new DateTime(REVISION_DATE))->format('Y') ?></p>
|
||||
--><p>© The <a href="https://git.esoko.eu/esoko/mapguesser" target="_blank">MapGuesser</a> Contributors <?= (new DateTime(REVISION_DATE))->format('Y') ?></p>
|
||||
</footer>
|
||||
@endsection
|
||||
Reference in new issue
Block a user