mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
Compare commits
21 Commits
wip-publis
...
fix-59
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cadc15a7a1 | ||
|
|
c1f6ce3ae2 | ||
|
|
864549cb4c | ||
|
|
5713d4b1ae | ||
|
|
ac502b7c08 | ||
|
|
8dc690ca01 | ||
|
|
a4f9c92b32 | ||
|
|
8826f6df8f | ||
|
|
af35fdb48e | ||
|
|
9fd8ffd666 | ||
|
|
521abd82d6 | ||
|
|
021f2fe5b4 | ||
|
|
b3e0ff6769 | ||
|
|
97abca2520 | ||
|
|
96a6c98c10 | ||
|
|
9d285573d7 | ||
|
|
d506d291c3 | ||
|
|
223e8fb8c2 | ||
|
|
2abf57d16b | ||
|
|
b3ee57d042 | ||
|
|
8c65edd257 |
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@@ -82,7 +82,7 @@ jobs:
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: configure GPG key
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/dumbserve'
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha'
|
||||
run: echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback
|
||||
env:
|
||||
RELEASE_BOT_GPG_SIGNING_KEY: ${{ secrets.RELEASE_BOT_GPG_SIGNING_KEY }}
|
||||
|
||||
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -3386,9 +3386,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "urlencoding"
|
||||
version = "2.1.0"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821"
|
||||
checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9"
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
|
||||
@@ -38,6 +38,7 @@ COPY --from=cacher /src/target target
|
||||
#COPY --from=cacher /src/db/db-migrations/target /src/db/db-migrations/target
|
||||
#COPY --from=cacher /src/utils/cache-bust/target /src/utils/cache-bust/target
|
||||
COPY --from=frontend /src/static/cache/bundle/ /src/static/cache/bundle/
|
||||
COPY --from=frontend /src/docs/openapi/dist/ /src/docs/openapi/dist/
|
||||
RUN cargo --version
|
||||
RUN make cache-bust
|
||||
RUN cargo build --release
|
||||
|
||||
@@ -73,9 +73,6 @@ impl Connect for ConnectionOptions {
|
||||
if fresh.disable_logging {
|
||||
connect_options.disable_statement_logging();
|
||||
}
|
||||
sqlx::mysql::MySqlConnectOptions::from_str(&fresh.url)
|
||||
.unwrap()
|
||||
.disable_statement_logging();
|
||||
fresh
|
||||
.pool_options
|
||||
.connect_with(connect_options)
|
||||
|
||||
@@ -73,9 +73,6 @@ impl Connect for ConnectionOptions {
|
||||
if fresh.disable_logging {
|
||||
connect_options.disable_statement_logging();
|
||||
}
|
||||
sqlx::postgres::PgConnectOptions::from_str(&fresh.url)
|
||||
.unwrap()
|
||||
.disable_statement_logging();
|
||||
fresh
|
||||
.pool_options
|
||||
.connect_with(connect_options)
|
||||
|
||||
@@ -97,14 +97,15 @@ delete_dir() {
|
||||
}
|
||||
|
||||
upload_dist() {
|
||||
delete_dir $1
|
||||
upload_dir="mCaptcha/$1"
|
||||
delete_dir $upload_dir
|
||||
|
||||
pushd $TMP_DIR
|
||||
for file in $TARBALL $TARBALL.asc $TARBALL.sha256
|
||||
do
|
||||
curl -v \
|
||||
-F upload=@$file \
|
||||
"$DUMBSERVE_HOST/api/v1/files/upload?path=$1/"
|
||||
"$DUMBSERVE_HOST/api/v1/files/upload?path=$upload_dir"
|
||||
done
|
||||
popd
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::{env, fs};
|
||||
|
||||
use config::{Config, ConfigError, Environment, File};
|
||||
use derive_more::Display;
|
||||
@@ -152,25 +152,34 @@ impl Settings {
|
||||
.expect("unable to set capatcha.enable_stats default config");
|
||||
|
||||
if let Ok(path) = env::var("MCAPTCHA_CONFIG") {
|
||||
s.merge(File::with_name(&path))?;
|
||||
let absolute_path = Path::new(&path).canonicalize().unwrap();
|
||||
log::info!(
|
||||
"Loading config file from {}",
|
||||
absolute_path.to_str().unwrap()
|
||||
);
|
||||
s.merge(File::with_name(absolute_path.to_str().unwrap()))?;
|
||||
} else if Path::new(CURRENT_DIR).exists() {
|
||||
let absolute_path = fs::canonicalize(CURRENT_DIR).unwrap();
|
||||
log::info!(
|
||||
"Loading config file from {}",
|
||||
absolute_path.to_str().unwrap()
|
||||
);
|
||||
// merging default config from file
|
||||
s.merge(File::with_name(CURRENT_DIR))?;
|
||||
s.merge(File::with_name(absolute_path.to_str().unwrap()))?;
|
||||
} else if Path::new(ETC).exists() {
|
||||
log::info!("{}", format!("Loading config file from {}", ETC));
|
||||
s.merge(File::with_name(ETC))?;
|
||||
} else {
|
||||
log::warn!("configuration file not found");
|
||||
log::warn!("Configuration file not found");
|
||||
}
|
||||
|
||||
s.merge(Environment::with_prefix("MCAPTCHA").separator("_"))?;
|
||||
|
||||
check_url(&s);
|
||||
|
||||
match env::var("PORT") {
|
||||
Ok(val) => {
|
||||
s.set("server.port", val).unwrap();
|
||||
}
|
||||
Err(e) => warn!("couldn't interpret PORT: {}", e),
|
||||
if let Ok(val) = env::var("PORT") {
|
||||
s.set("server.port", val).unwrap();
|
||||
log::info!("Overriding [server].port with environment variable");
|
||||
}
|
||||
|
||||
match env::var("DATABASE_URL") {
|
||||
@@ -180,6 +189,7 @@ impl Settings {
|
||||
let database_type = DBType::from_url(&url).unwrap();
|
||||
s.set("database.database_type", database_type.to_string())
|
||||
.unwrap();
|
||||
log::info!("Overriding [database].url and [database].database_type with environment variable");
|
||||
}
|
||||
Err(e) => {
|
||||
set_database_url(&mut s);
|
||||
@@ -215,8 +225,11 @@ fn set_database_url(s: &mut Config) {
|
||||
r"postgres://{}:{}@{}:{}/{}",
|
||||
s.get::<String>("database.username")
|
||||
.expect("Couldn't access database username"),
|
||||
s.get::<String>("database.password")
|
||||
.expect("Couldn't access database password"),
|
||||
urlencoding::encode(
|
||||
s.get::<String>("database.password")
|
||||
.expect("Couldn't access database password")
|
||||
.as_str()
|
||||
),
|
||||
s.get::<String>("database.hostname")
|
||||
.expect("Couldn't access database hostname"),
|
||||
s.get::<String>("database.port")
|
||||
|
||||
@@ -8,6 +8,16 @@
|
||||
class="auth__logo" alt="mcaptcha logo" />
|
||||
|
||||
|
||||
<. if !crate::SETTINGS.allow_registration { .>
|
||||
<table class="reg-closed__table">
|
||||
<thead class="reg-closed__table-heading">
|
||||
<tr><th colspan="4" class="reg-closed__table-title-text">Registration closed</th></tr>
|
||||
</thead>
|
||||
<tbody class="reg-closed__body">
|
||||
<tr><td class="reg-closed__body-text">This mCaptcha instance is closed for registrations.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<. } else {.>
|
||||
<form
|
||||
method="POST"
|
||||
action="<.= crate::V1_API_ROUTES.auth.register .>"
|
||||
@@ -73,5 +83,6 @@
|
||||
<a href="<.= crate::PAGES.auth.login .>" class="auth__secondary-action__link">Log in</a>
|
||||
</p>
|
||||
<. include!("../demo-user-banner.html"); .>
|
||||
<. } .>
|
||||
</div>
|
||||
<. include!("../../components/footers.html"); .>
|
||||
|
||||
32
templates/auth/register/main.scss
Normal file
32
templates/auth/register/main.scss
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Gusted <postmaster@gusted.xyz>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@import '../../components/table/main';
|
||||
|
||||
.reg-closed__table {
|
||||
@include table;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.reg-closed__table-title-text {
|
||||
@include table__title-text;
|
||||
}
|
||||
|
||||
.reg-closed__body-text {
|
||||
display: block;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
@@ -19,11 +19,12 @@
|
||||
<span id="widget__verification-text--before">I'm not a robot</span>
|
||||
<span id="widget__verification-text--during">Processing...</span>
|
||||
<span id="widget__verification-text--after">Verified!</span>
|
||||
<span id="widget__verification-text--error">Something wen't wrong</span>
|
||||
<span id="widget__verification-text--error">Something went wrong</span>
|
||||
</label>
|
||||
<div class="widget__mcaptcha-details">
|
||||
<a href="<.= crate::PKG_HOMEPAGE .>"
|
||||
class="widget__mcaptcha-logo-container"
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
class="widget__mcaptcha-logo"
|
||||
@@ -33,12 +34,14 @@
|
||||
<p class="widget__mcaptcha-brand-name">mCaptcha</p>
|
||||
</a>
|
||||
<div class="widget__mcaptcha-info-container">
|
||||
<a class="widget__mcaptcha-info-link"
|
||||
href="<.= crate::PKG_HOMEPAGE .><.= crate::PAGES.privacy .>">
|
||||
<a class="widget__mcaptcha-info-link"
|
||||
target="_blank"
|
||||
href="<.= crate::PKG_HOMEPAGE .><.= crate::PAGES.privacy .>">
|
||||
Privacy
|
||||
</a>
|
||||
<a class="widget__mcaptcha-info-link"
|
||||
href="<.= crate::PKG_HOMEPAGE .><.= crate::PAGES.security .>">
|
||||
target="_blank"
|
||||
href="<.= crate::PKG_HOMEPAGE .><.= crate::PAGES.security .>">
|
||||
Terms
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user