diff --git a/.version b/.version index b52282a1..46b81d81 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.10.4 +2.11.0 diff --git a/Jenkinsfile b/Jenkinsfile index 862b2470..0d0eee03 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,13 +17,11 @@ pipeline { IMAGE = 'nginx-proxy-manager' BUILD_VERSION = getVersion() MAJOR_VERSION = '2' - BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('/', '-')}" + BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('\\\\', '-').replaceAll('/', '-').replaceAll('\\.', '-')}" COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}" COMPOSE_FILE = 'docker/docker-compose.ci.yml' COMPOSE_INTERACTIVE_NO_CLI = 1 BUILDX_NAME = "${COMPOSE_PROJECT_NAME}" - DOCS_BUCKET = 'jc21-npm-site' - DOCS_CDN = 'EN1G6DEWZUTDT' } stages { stage('Environment') { @@ -62,103 +60,114 @@ pipeline { } } } - stage('Build and Test') { - steps { - script { - // Frontend and Backend - def shStatusCode = sh(label: 'Checking and Building', returnStatus: true, script: ''' - set -e - ./scripts/ci/frontend-build > ${WORKSPACE}/tmp-sh-build 2>&1 - ./scripts/ci/test-and-build > ${WORKSPACE}/tmp-sh-build 2>&1 - ''') - shOutput = readFile "${env.WORKSPACE}/tmp-sh-build" - if (shStatusCode != 0) { - error "${shOutput}" + stage('Builds') { + parallel { + stage('Project') { + steps { + script { + // Frontend and Backend + def shStatusCode = sh(label: 'Checking and Building', returnStatus: true, script: ''' + set -e + ./scripts/ci/frontend-build > ${WORKSPACE}/tmp-sh-build 2>&1 + ./scripts/ci/test-and-build > ${WORKSPACE}/tmp-sh-build 2>&1 + ''') + shOutput = readFile "${env.WORKSPACE}/tmp-sh-build" + if (shStatusCode != 0) { + error "${shOutput}" + } + } + } + post { + always { + sh 'rm -f ${WORKSPACE}/tmp-sh-build' + } + failure { + npmGithubPrComment("CI Error:\n\n```\n${shOutput}\n```", true) + } + } + } + stage('Docs') { + steps { + dir(path: 'docs') { + sh 'yarn install' + sh 'yarn build' + } + dir(path: 'docs/.vuepress/dist') { + sh 'tar -czf ../../docs.tgz *' + } + archiveArtifacts(artifacts: 'docs/docs.tgz', allowEmptyArchive: false) + } + } + stage('Cypress') { + steps { + // Creating will also create the network prior to + // using it in parallel stages below and mitigating + // a race condition. + sh 'docker-compose build cypress-sqlite' + sh 'docker-compose build cypress-mysql' + sh 'docker-compose create cypress-sqlite' + sh 'docker-compose create cypress-mysql' } } } - post { - always { - sh 'rm -f ${WORKSPACE}/tmp-sh-build' - } - failure { - npmGithubPrComment("CI Error:\n\n```\n${shOutput}\n```", true) - } - } } - stage('Integration Tests Sqlite') { - steps { - // Bring up a stack - sh 'docker-compose up -d fullstack-sqlite' - sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120' - // Stop and Start it, as this will test it's ability to restart with existing data - sh 'docker-compose stop fullstack-sqlite' - sh 'docker-compose start fullstack-sqlite' - sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120' + stage('Integration Tests') { + parallel { + stage('Sqlite') { + steps { + // Bring up a stack + sh 'docker-compose up -d fullstack-sqlite' + sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120' + // Stop and Start it, as this will test it's ability to restart with existing data + sh 'docker-compose stop fullstack-sqlite' + sh 'docker-compose start fullstack-sqlite' + sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120' - // Run tests - sh 'rm -rf test/results' - sh 'docker-compose up cypress-sqlite' - // Get results - sh 'docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/' - } - post { - always { - // Dumps to analyze later - sh 'mkdir -p debug' - sh 'docker-compose logs fullstack-sqlite > debug/docker_fullstack_sqlite.log' - sh 'docker-compose logs db > debug/docker_db.log' - // Cypress videos and screenshot artifacts - dir(path: 'test/results') { - archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml' + // Run tests + sh 'rm -rf test/results-sqlite' + sh 'docker-compose up cypress-sqlite' + // Get results + sh 'docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/results-sqlite' } - junit 'test/results/junit/*' - } - } - } - stage('Integration Tests Mysql') { - steps { - // Bring up a stack - sh 'docker-compose up -d fullstack-mysql' - sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120' - - // Run tests - sh 'rm -rf test/results' - sh 'docker-compose up cypress-mysql' - // Get results - sh 'docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/' - } - post { - always { - // Dumps to analyze later - sh 'mkdir -p debug' - sh 'docker-compose logs fullstack-mysql > debug/docker_fullstack_mysql.log' - sh 'docker-compose logs db > debug/docker_db.log' - // Cypress videos and screenshot artifacts - dir(path: 'test/results') { - archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml' + post { + always { + // Dumps to analyze later + sh 'mkdir -p debug/sqlite' + sh 'docker-compose logs fullstack-sqlite > debug/sqlite/docker_fullstack_sqlite.log' + // Cypress videos and screenshot artifacts + dir(path: 'test/results-sqlite') { + archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml' + } + junit 'test/results-sqlite/junit/*' + } } - junit 'test/results/junit/*' - } - } - } - stage('Docs') { - when { - not { - equals expected: 'UNSTABLE', actual: currentBuild.result - } - } - steps { - dir(path: 'docs') { - sh 'yarn install' - sh 'yarn build' } + stage('Mysql') { + steps { + // Bring up a stack + sh 'docker-compose up -d fullstack-mysql' + sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120' - dir(path: 'docs/.vuepress/dist') { - sh 'tar -czf ../../docs.tgz *' + // Run tests + sh 'rm -rf test/results-mysql' + sh 'docker-compose up cypress-mysql' + // Get results + sh 'docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/results-mysql' + } + post { + always { + // Dumps to analyze later + sh 'mkdir -p debug/mysql' + sh 'docker-compose logs fullstack-mysql > debug/mysql/docker_fullstack_mysql.log' + sh 'docker-compose logs db > debug/mysql/docker_db.log' + // Cypress videos and screenshot artifacts + dir(path: 'test/results-mysql') { + archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml' + } + junit 'test/results-mysql/junit/*' + } + } } - - archiveArtifacts(artifacts: 'docs/docs.tgz', allowEmptyArchive: false) } } stage('MultiArch Build') { @@ -174,31 +183,48 @@ pipeline { } } } - stage('Docs Deploy') { - when { - allOf { - branch 'master' - not { - equals expected: 'UNSTABLE', actual: currentBuild.result + stage('Docs / Comment') { + parallel { + stage('Master Docs') { + when { + allOf { + branch 'master' + not { + equals expected: 'UNSTABLE', actual: currentBuild.result + } + } + } + steps { + npmDocsReleaseMaster() } } - } - steps { - npmDocsRelease("$DOCS_BUCKET", "$DOCS_CDN") - } - } - stage('PR Comment') { - when { - allOf { - changeRequest() - not { - equals expected: 'UNSTABLE', actual: currentBuild.result + stage('Develop Docs') { + when { + allOf { + branch 'develop' + not { + equals expected: 'UNSTABLE', actual: currentBuild.result + } + } + } + steps { + npmDocsReleaseDevelop() } } - } - steps { - script { - npmGithubPrComment("Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${IMAGE}) as `jc21/${IMAGE}:github-${BRANCH_LOWER}`\n\n**Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.", true) + stage('PR Comment') { + when { + allOf { + changeRequest() + not { + equals expected: 'UNSTABLE', actual: currentBuild.result + } + } + } + steps { + script { + npmGithubPrComment("Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${IMAGE}) as `jc21/${IMAGE}:github-${BRANCH_LOWER}`\n\n**Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.", true) + } + } } } } @@ -214,12 +240,12 @@ pipeline { sh 'figlet "SUCCESS"' } failure { - archiveArtifacts(artifacts: 'debug/**.*', allowEmptyArchive: true) + archiveArtifacts(artifacts: 'debug/**/*.*', allowEmptyArchive: true) juxtapose event: 'failure' sh 'figlet "FAILURE"' } unstable { - archiveArtifacts(artifacts: 'debug/**.*', allowEmptyArchive: true) + archiveArtifacts(artifacts: 'debug/**/*.*', allowEmptyArchive: true) juxtapose event: 'unstable' sh 'figlet "UNSTABLE"' } diff --git a/README.md b/README.md index 0bad17f6..6fd16aed 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
1024,I&&(t.dump&&Zw===t.dump.charCodeAt(0)?v+="?":v+="? "),v+=t.dump,I&&(v+=wR(t,e)),Zg(t,e+1,E,!0,I)&&(t.dump&&Zw===t.dump.charCodeAt(0)?v+=":":v+=": ",v+=t.dump,a+=v));t.tag=n,t.dump=a||"{}"}function FV(t,e,r){var o,a,n,u,A,p;for(a=r?t.explicitTypes:t.implicitTypes,n=0,u=a.length;n tag resolver accepts not "'+p+'" style');t.dump=o}return!0}return!1}function Zg(t,e,r,o,a,n){t.tag=null,t.dump=r,FV(t,r,!1)||FV(t,r,!0);var u=TV.call(t.dump);o&&(o=t.flowLevel<0||t.flowLevel>e);var A=u==="[object Object]"||u==="[object Array]",p,h;if(A&&(p=t.duplicates.indexOf(r),h=p!==-1),(t.tag!==null&&t.tag!=="?"||h||t.indent!==2&&e>0)&&(a=!1),h&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(A&&h&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),u==="[object Object]")o&&Object.keys(t.dump).length!==0?(W6e(t,e,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(Y6e(t,e,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump));else if(u==="[object Array]"){var E=t.noArrayIndent&&e>0?e-1:e;o&&t.dump.length!==0?(G6e(t,E,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(q6e(t,E,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump))}else if(u==="[object String]")t.tag!=="?"&&_6e(t,t.dump,e,n);else{if(t.skipInvalid)return!1;throw new eI("unacceptable kind of an object to dump "+u)}t.tag!==null&&t.tag!=="?"&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function V6e(t,e){var r=[],o=[],a,n;for(IR(t,r,o),a=0,n=o.length;a
-
+
@@ -98,7 +98,18 @@ Password: changeme
Immediately after logging in with this default user you will be asked to modify your details and change your password.
-## Contributors
+## Contributing
+
+All are welcome to create pull requests for this project, against the `develop` branch. Official releases are created from the `master` branch.
+
+CI is used in this project. All PR's must pass before being considered. After passing,
+docker builds for PR's are available on dockerhub for manual verifications.
+
+Documentation within the `develop` branch is available for preview at
+[https://develop.nginxproxymanager.com](https://develop.nginxproxymanager.com)
+
+
+### Contributors
Special thanks to [all of our contributors](https://github.com/NginxProxyManager/nginx-proxy-manager/graphs/contributors).
@@ -107,5 +118,4 @@ Special thanks to [all of our contributors](https://github.com/NginxProxyManager
1. [Found a bug?](https://github.com/NginxProxyManager/nginx-proxy-manager/issues)
2. [Discussions](https://github.com/NginxProxyManager/nginx-proxy-manager/discussions)
-3. [Development Gitter](https://gitter.im/nginx-proxy-manager/community)
-4. [Reddit](https://reddit.com/r/nginxproxymanager)
+3. [Reddit](https://reddit.com/r/nginxproxymanager)
diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js
index 871a2805..8a917ef1 100644
--- a/backend/internal/certificate.js
+++ b/backend/internal/certificate.js
@@ -8,6 +8,7 @@ const config = require('../lib/config');
const error = require('../lib/error');
const utils = require('../lib/utils');
const certificateModel = require('../models/certificate');
+const tokenModel = require('../models/token');
const dnsPlugins = require('../global/certbot-dns-plugins');
const internalAuditLog = require('./audit-log');
const internalNginx = require('./nginx');
@@ -26,10 +27,11 @@ function omissions() {
const internalCertificate = {
- allowedSslFiles: ['certificate', 'certificate_key', 'intermediate_certificate'],
- intervalTimeout: 1000 * 60 * 60, // 1 hour
- interval: null,
- intervalProcessing: false,
+ allowedSslFiles: ['certificate', 'certificate_key', 'intermediate_certificate'],
+ intervalTimeout: 1000 * 60 * 60, // 1 hour
+ interval: null,
+ intervalProcessing: false,
+ renewBeforeExpirationBy: [30, 'days'],
initTimer: () => {
logger.info('Let\'s Encrypt Renewal Timer initialized');
@@ -44,62 +46,51 @@ const internalCertificate = {
processExpiringHosts: () => {
if (!internalCertificate.intervalProcessing) {
internalCertificate.intervalProcessing = true;
- logger.info('Renewing SSL certs close to expiry...');
+ logger.info('Renewing SSL certs expiring within ' + internalCertificate.renewBeforeExpirationBy[0] + ' ' + internalCertificate.renewBeforeExpirationBy[1] + ' ...');
- const cmd = certbotCommand + ' renew --non-interactive --quiet ' +
- '--config "' + letsencryptConfig + '" ' +
- '--work-dir "/tmp/letsencrypt-lib" ' +
- '--logs-dir "/tmp/letsencrypt-log" ' +
- '--preferred-challenges "dns,http" ' +
- '--disable-hook-validation ' +
- (letsencryptStaging ? '--staging' : '');
+ const expirationThreshold = moment().add(internalCertificate.renewBeforeExpirationBy[0], internalCertificate.renewBeforeExpirationBy[1]).format('YYYY-MM-DD HH:mm:ss');
- return utils.exec(cmd)
- .then((result) => {
- if (result) {
- logger.info('Renew Result: ' + result);
+ // Fetch all the letsencrypt certs from the db that will expire within the configured threshold
+ certificateModel
+ .query()
+ .where('is_deleted', 0)
+ .andWhere('provider', 'letsencrypt')
+ .andWhere('expires_on', '<', expirationThreshold)
+ .then((certificates) => {
+ if (!certificates || !certificates.length) {
+ return null;
}
- return internalNginx.reload()
- .then(() => {
- logger.info('Renew Complete');
- return result;
- });
- })
- .then(() => {
- // Now go and fetch all the letsencrypt certs from the db and query the files and update expiry times
- return certificateModel
- .query()
- .where('is_deleted', 0)
- .andWhere('provider', 'letsencrypt')
- .then((certificates) => {
- if (certificates && certificates.length) {
- let promises = [];
-
- certificates.map(function (certificate) {
- promises.push(
- internalCertificate.getCertificateInfoFromFile('/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem')
- .then((cert_info) => {
- return certificateModel
- .query()
- .where('id', certificate.id)
- .andWhere('provider', 'letsencrypt')
- .patch({
- expires_on: moment(cert_info.dates.to, 'X').format('YYYY-MM-DD HH:mm:ss')
- });
- })
- .catch((err) => {
- // Don't want to stop the train here, just log the error
- logger.error(err.message);
- })
- );
- });
-
- return Promise.all(promises);
- }
- });
+ /**
+ * Renews must be run sequentially or we'll get an error 'Another
+ * instance of Certbot is already running.'
+ */
+ let sequence = Promise.resolve();
+
+ certificates.forEach(function (certificate) {
+ sequence = sequence.then(() =>
+ internalCertificate
+ .renew(
+ {
+ can: () =>
+ Promise.resolve({
+ permission_visibility: 'all',
+ }),
+ token: new tokenModel(),
+ },
+ { id: certificate.id },
+ )
+ .catch((err) => {
+ // Don't want to stop the train here, just log the error
+ logger.error(err.message);
+ }),
+ );
+ });
+
+ return sequence;
})
.then(() => {
+ logger.info('Completed SSL cert renew process');
internalCertificate.intervalProcessing = false;
})
.catch((err) => {
@@ -908,6 +899,10 @@ const internalCertificate = {
mainCmd = 'AWS_CONFIG_FILE=\'' + credentialsLocation + '\' ' + mainCmd;
}
+ if (certificate.meta.dns_provider === 'duckdns') {
+ mainCmd = mainCmd + ' --dns-duckdns-no-txt-restore';
+ }
+
logger.info('Command:', `${credentialsCmd} && ${prepareCmd} && ${mainCmd}`);
return utils.exec(credentialsCmd)
@@ -1012,7 +1007,7 @@ const internalCertificate = {
logger.info(`Renewing Let'sEncrypt certificates via ${dns_plugin.display_name} for Cert #${certificate.id}: ${certificate.domain_names.join(', ')}`);
- let mainCmd = certbotCommand + ' renew ' +
+ let mainCmd = certbotCommand + ' renew --force-renewal ' +
'--config "' + letsencryptConfig + '" ' +
'--work-dir "/tmp/letsencrypt-lib" ' +
'--logs-dir "/tmp/letsencrypt-log" ' +
@@ -1046,6 +1041,8 @@ const internalCertificate = {
const mainCmd = certbotCommand + ' revoke ' +
'--config "' + letsencryptConfig + '" ' +
+ '--work-dir "/tmp/letsencrypt-lib" ' +
+ '--logs-dir "/tmp/letsencrypt-log" ' +
'--cert-path "/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem" ' +
'--delete-after-revoke ' +
(letsencryptStaging ? '--staging' : '');
@@ -1163,6 +1160,7 @@ const internalCertificate = {
const options = {
method: 'POST',
headers: {
+ 'User-Agent': 'Mozilla/5.0',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(formBody)
}
@@ -1175,12 +1173,22 @@ const internalCertificate = {
res.on('data', (chunk) => responseBody = responseBody + chunk);
res.on('end', function () {
- const parsedBody = JSON.parse(responseBody + '');
- if (res.statusCode !== 200) {
- logger.warn(`Failed to test HTTP challenge for domain ${domain}`, res);
+ try {
+ const parsedBody = JSON.parse(responseBody + '');
+ if (res.statusCode !== 200) {
+ logger.warn(`Failed to test HTTP challenge for domain ${domain} because HTTP status code ${res.statusCode} was returned: ${parsedBody.message}`);
+ resolve(undefined);
+ } else {
+ resolve(parsedBody);
+ }
+ } catch (err) {
+ if (res.statusCode !== 200) {
+ logger.warn(`Failed to test HTTP challenge for domain ${domain} because HTTP status code ${res.statusCode} was returned`);
+ } else {
+ logger.warn(`Failed to test HTTP challenge for domain ${domain} because response failed to be parsed: ${err.message}`);
+ }
resolve(undefined);
}
- resolve(parsedBody);
});
});
@@ -1194,6 +1202,9 @@ const internalCertificate = {
if (!result) {
// Some error occurred while trying to get the data
return 'failed';
+ } else if (result.error) {
+ logger.info(`HTTP challenge test failed for domain ${domain} because error was returned: ${result.error.msg}`);
+ return `other:${result.error.msg}`;
} else if (`${result.responsecode}` === '200' && result.htmlresponse === 'Success') {
// Server exists and has responded with the correct data
return 'ok';
diff --git a/backend/internal/proxy-host.js b/backend/internal/proxy-host.js
index 02a98da2..dbff1147 100644
--- a/backend/internal/proxy-host.js
+++ b/backend/internal/proxy-host.js
@@ -225,7 +225,7 @@ const internalProxyHost = {
.query()
.where('is_deleted', 0)
.andWhere('id', data.id)
- .allowGraph('[owner,access_list,access_list.[clients,items],certificate]')
+ .allowGraph('[owner,access_list.[clients,items],certificate]')
.first();
if (access_data.permission_visibility !== 'all') {
diff --git a/backend/schema/definitions.json b/backend/schema/definitions.json
index 4b4f3405..6e0cf6aa 100644
--- a/backend/schema/definitions.json
+++ b/backend/schema/definitions.json
@@ -172,7 +172,7 @@
"description": "Domain Names separated by a comma",
"example": "*.jc21.com,blog.jc21.com",
"type": "array",
- "maxItems": 15,
+ "maxItems": 30,
"uniqueItems": true,
"items": {
"type": "string",
diff --git a/backend/templates/_hsts.conf b/backend/templates/_hsts.conf
index 11aecf24..26c83ee8 100644
--- a/backend/templates/_hsts.conf
+++ b/backend/templates/_hsts.conf
@@ -2,7 +2,7 @@
{% if ssl_forced == 1 or ssl_forced == true %}
{% if hsts_enabled == 1 or hsts_enabled == true %}
# HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
- add_header Strict-Transport-Security "max-age=63072000;{% if hsts_subdomains == 1 or hsts_subdomains == true -%} includeSubDomains;{% endif %} preload" always;
+ add_header Strict-Transport-Security $hsts_header always;
{% endif %}
{% endif %}
{% endif %}
diff --git a/backend/templates/_hsts_map.conf b/backend/templates/_hsts_map.conf
new file mode 100644
index 00000000..27dd1f8f
--- /dev/null
+++ b/backend/templates/_hsts_map.conf
@@ -0,0 +1,3 @@
+map $scheme $hsts_header {
+ https "max-age=63072000;{% if hsts_subdomains == 1 or hsts_subdomains == true -%} includeSubDomains;{% endif %} preload";
+}
\ No newline at end of file
diff --git a/backend/templates/_listen.conf b/backend/templates/_listen.conf
index 730f3a7c..ad1c96ba 100644
--- a/backend/templates/_listen.conf
+++ b/backend/templates/_listen.conf
@@ -5,9 +5,9 @@
#listen [::]:80;
{% endif %}
{% if certificate -%}
- listen 443 ssl{% if http2_support %} http2{% endif %};
+ listen 443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %};
{% if ipv6 -%}
- listen [::]:443 ssl{% if http2_support %} http2{% endif %};
+ listen [::]:443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %};
{% else -%}
#listen [::]:443;
{% endif %}
diff --git a/backend/templates/_location.conf b/backend/templates/_location.conf
index 2ee0d31b..c561c274 100644
--- a/backend/templates/_location.conf
+++ b/backend/templates/_location.conf
@@ -1,3 +1,5 @@
+ {% include "_hsts_map.conf" %}
+
location {{ path }} {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
diff --git a/backend/templates/dead_host.conf b/backend/templates/dead_host.conf
index d94dff57..7a06469a 100644
--- a/backend/templates/dead_host.conf
+++ b/backend/templates/dead_host.conf
@@ -1,6 +1,9 @@
{% include "_header_comment.conf" %}
{% if enabled %}
+
+{% include "_hsts_map.conf" %}
+
server {
{% include "_listen.conf" %}
{% include "_certificates.conf" %}
diff --git a/backend/templates/proxy_host.conf b/backend/templates/proxy_host.conf
index 81a542ea..d23ca46f 100644
--- a/backend/templates/proxy_host.conf
+++ b/backend/templates/proxy_host.conf
@@ -1,6 +1,9 @@
{% include "_header_comment.conf" %}
{% if enabled %}
+
+{% include "_hsts_map.conf" %}
+
server {
set $forward_scheme {{ forward_scheme }};
set $server "{{ forward_host }}";
diff --git a/backend/templates/redirection_host.conf b/backend/templates/redirection_host.conf
index 339fe72e..7dd36079 100644
--- a/backend/templates/redirection_host.conf
+++ b/backend/templates/redirection_host.conf
@@ -1,6 +1,9 @@
{% include "_header_comment.conf" %}
{% if enabled %}
+
+{% include "_hsts_map.conf" %}
+
server {
{% include "_listen.conf" %}
{% include "_certificates.conf" %}
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 82ec9355..799ee2a6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -3,7 +3,7 @@
# This file assumes that the frontend has been built using ./scripts/frontend-build
-FROM jc21/nginx-full:certbot-node
+FROM nginxproxymanager/nginx-full:certbot-node
ARG TARGETPLATFORM
ARG BUILD_VERSION
@@ -20,7 +20,8 @@ ENV SUPPRESS_NO_CONFIG_WARNING=1 \
NODE_ENV=production \
NPM_BUILD_VERSION="${BUILD_VERSION}" \
NPM_BUILD_COMMIT="${BUILD_COMMIT}" \
- NPM_BUILD_DATE="${BUILD_DATE}"
+ NPM_BUILD_DATE="${BUILD_DATE}" \
+ NODE_OPTIONS="--openssl-legacy-provider"
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
&& apt-get update \
@@ -47,11 +48,9 @@ COPY docker/rootfs /
# Remove frontend service not required for prod, dev nginx config as well
RUN rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/frontend /etc/nginx/conf.d/dev.conf \
- && chmod 644 /etc/logrotate.d/nginx-proxy-manager \
- && pip uninstall --yes setuptools \
- && pip install --no-cache-dir "setuptools==58.0.0"
+ && chmod 644 /etc/logrotate.d/nginx-proxy-manager
-VOLUME [ "/data", "/etc/letsencrypt" ]
+VOLUME [ "/data" ]
ENTRYPOINT [ "/init" ]
LABEL org.label-schema.schema-version="1.0" \
diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile
index 749ac343..3c21849c 100644
--- a/docker/dev/Dockerfile
+++ b/docker/dev/Dockerfile
@@ -1,4 +1,4 @@
-FROM jc21/nginx-full:certbot-node
+FROM nginxproxymanager/nginx-full:certbot-node
LABEL maintainer="Jamie Curnow
Hi&&(Hi=Ce,fu=[]),fu.push($))}function lo($,me){return new $g($,null,null,me)}function gc($,me,Le){return new $g($g.buildMessage($,me),$,me,Le)}function pu(){var $;return $=xA(),$}function ji(){var $,me,Le;for($=Ce,me=[],Le=hu();Le!==r;)me.push(Le),Le=hu();return me!==r&&(Tt=$,me=n(me)),$=me,$}function hu(){var $,me,Le,ft,pt;return $=Ce,me=hs(),me!==r?(t.charCodeAt(Ce)===45?(Le=u,Ce++):(Le=r,Yt===0&&Ze(A)),Le!==r?(ft=Pn(),ft!==r?(pt=dc(),pt!==r?(Tt=$,me=p(pt),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$}function xA(){var $,me,Le;for($=Ce,me=[],Le=Ua();Le!==r;)me.push(Le),Le=Ua();return me!==r&&(Tt=$,me=h(me)),$=me,$}function Ua(){var $,me,Le,ft,pt,Rt,er,Zr,qi;if($=Ce,me=Pn(),me===r&&(me=null),me!==r){if(Le=Ce,t.charCodeAt(Ce)===35?(ft=E,Ce++):(ft=r,Yt===0&&Ze(I)),ft!==r){if(pt=[],Rt=Ce,er=Ce,Yt++,Zr=tt(),Yt--,Zr===r?er=void 0:(Ce=er,er=r),er!==r?(t.length>Ce?(Zr=t.charAt(Ce),Ce++):(Zr=r,Yt===0&&Ze(v)),Zr!==r?(er=[er,Zr],Rt=er):(Ce=Rt,Rt=r)):(Ce=Rt,Rt=r),Rt!==r)for(;Rt!==r;)pt.push(Rt),Rt=Ce,er=Ce,Yt++,Zr=tt(),Yt--,Zr===r?er=void 0:(Ce=er,er=r),er!==r?(t.length>Ce?(Zr=t.charAt(Ce),Ce++):(Zr=r,Yt===0&&Ze(v)),Zr!==r?(er=[er,Zr],Rt=er):(Ce=Rt,Rt=r)):(Ce=Rt,Rt=r);else pt=r;pt!==r?(ft=[ft,pt],Le=ft):(Ce=Le,Le=r)}else Ce=Le,Le=r;if(Le===r&&(Le=null),Le!==r){if(ft=[],pt=We(),pt!==r)for(;pt!==r;)ft.push(pt),pt=We();else ft=r;ft!==r?(Tt=$,me=b(),$=me):(Ce=$,$=r)}else Ce=$,$=r}else Ce=$,$=r;if($===r&&($=Ce,me=hs(),me!==r?(Le=oa(),Le!==r?(ft=Pn(),ft===r&&(ft=null),ft!==r?(t.charCodeAt(Ce)===58?(pt=C,Ce++):(pt=r,Yt===0&&Ze(T)),pt!==r?(Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(er=dc(),er!==r?(Tt=$,me=L(Le,er),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r&&($=Ce,me=hs(),me!==r?(Le=co(),Le!==r?(ft=Pn(),ft===r&&(ft=null),ft!==r?(t.charCodeAt(Ce)===58?(pt=C,Ce++):(pt=r,Yt===0&&Ze(T)),pt!==r?(Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(er=dc(),er!==r?(Tt=$,me=L(Le,er),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r))){if($=Ce,me=hs(),me!==r)if(Le=co(),Le!==r)if(ft=Pn(),ft!==r)if(pt=aa(),pt!==r){if(Rt=[],er=We(),er!==r)for(;er!==r;)Rt.push(er),er=We();else Rt=r;Rt!==r?(Tt=$,me=L(Le,pt),$=me):(Ce=$,$=r)}else Ce=$,$=r;else Ce=$,$=r;else Ce=$,$=r;else Ce=$,$=r;if($===r)if($=Ce,me=hs(),me!==r)if(Le=co(),Le!==r){if(ft=[],pt=Ce,Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(t.charCodeAt(Ce)===44?(er=U,Ce++):(er=r,Yt===0&&Ze(J)),er!==r?(Zr=Pn(),Zr===r&&(Zr=null),Zr!==r?(qi=co(),qi!==r?(Tt=pt,Rt=te(Le,qi),pt=Rt):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r),pt!==r)for(;pt!==r;)ft.push(pt),pt=Ce,Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(t.charCodeAt(Ce)===44?(er=U,Ce++):(er=r,Yt===0&&Ze(J)),er!==r?(Zr=Pn(),Zr===r&&(Zr=null),Zr!==r?(qi=co(),qi!==r?(Tt=pt,Rt=te(Le,qi),pt=Rt):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r);else ft=r;ft!==r?(pt=Pn(),pt===r&&(pt=null),pt!==r?(t.charCodeAt(Ce)===58?(Rt=C,Ce++):(Rt=r,Yt===0&&Ze(T)),Rt!==r?(er=Pn(),er===r&&(er=null),er!==r?(Zr=dc(),Zr!==r?(Tt=$,me=le(Le,ft,Zr),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)}else Ce=$,$=r;else Ce=$,$=r}return $}function dc(){var $,me,Le,ft,pt,Rt,er;if($=Ce,me=Ce,Yt++,Le=Ce,ft=tt(),ft!==r?(pt=_t(),pt!==r?(t.charCodeAt(Ce)===45?(Rt=u,Ce++):(Rt=r,Yt===0&&Ze(A)),Rt!==r?(er=Pn(),er!==r?(ft=[ft,pt,Rt,er],Le=ft):(Ce=Le,Le=r)):(Ce=Le,Le=r)):(Ce=Le,Le=r)):(Ce=Le,Le=r),Yt--,Le!==r?(Ce=me,me=void 0):me=r,me!==r?(Le=We(),Le!==r?(ft=Fn(),ft!==r?(pt=ji(),pt!==r?(Rt=Ci(),Rt!==r?(Tt=$,me=pe(pt),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r&&($=Ce,me=tt(),me!==r?(Le=Fn(),Le!==r?(ft=xA(),ft!==r?(pt=Ci(),pt!==r?(Tt=$,me=pe(ft),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r))if($=Ce,me=Us(),me!==r){if(Le=[],ft=We(),ft!==r)for(;ft!==r;)Le.push(ft),ft=We();else Le=r;Le!==r?(Tt=$,me=Ae(me),$=me):(Ce=$,$=r)}else Ce=$,$=r;return $}function hs(){var $,me,Le;for(Yt++,$=Ce,me=[],t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));Le!==r;)me.push(Le),t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));return me!==r?(Tt=Ce,Le=Pe(me),Le?Le=void 0:Le=r,Le!==r?(me=[me,Le],$=me):(Ce=$,$=r)):(Ce=$,$=r),Yt--,$===r&&(me=r,Yt===0&&Ze(ye)),$}function _t(){var $,me,Le;for($=Ce,me=[],t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));Le!==r;)me.push(Le),t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));return me!==r?(Tt=Ce,Le=g(me),Le?Le=void 0:Le=r,Le!==r?(me=[me,Le],$=me):(Ce=$,$=r)):(Ce=$,$=r),$}function Fn(){var $;return Tt=Ce,$=Ee(),$?$=void 0:$=r,$}function Ci(){var $;return Tt=Ce,$=De(),$?$=void 0:$=r,$}function oa(){var $;return $=ds(),$===r&&($=la()),$}function co(){var $,me,Le;if($=ds(),$===r){if($=Ce,me=[],Le=Ho(),Le!==r)for(;Le!==r;)me.push(Le),Le=Ho();else me=r;me!==r&&(Tt=$,me=ce()),$=me}return $}function Us(){var $;return $=wi(),$===r&&($=gs(),$===r&&($=ds(),$===r&&($=la()))),$}function aa(){var $;return $=wi(),$===r&&($=ds(),$===r&&($=Ho())),$}function la(){var $,me,Le,ft,pt,Rt;if(Yt++,$=Ce,ee.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(Ie)),me!==r){for(Le=[],ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(ke.test(t.charAt(Ce))?(Rt=t.charAt(Ce),Ce++):(Rt=r,Yt===0&&Ze(ht)),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);ft!==r;)Le.push(ft),ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(ke.test(t.charAt(Ce))?(Rt=t.charAt(Ce),Ce++):(Rt=r,Yt===0&&Ze(ht)),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);Le!==r?(Tt=$,me=H(),$=me):(Ce=$,$=r)}else Ce=$,$=r;return Yt--,$===r&&(me=r,Yt===0&&Ze(ne)),$}function Ho(){var $,me,Le,ft,pt;if($=Ce,t.substr(Ce,2)===lt?(me=lt,Ce+=2):(me=r,Yt===0&&Ze(Re)),me===r&&(me=null),me!==r)if(Qe.test(t.charAt(Ce))?(Le=t.charAt(Ce),Ce++):(Le=r,Yt===0&&Ze(be)),Le!==r){for(ft=[],_e.test(t.charAt(Ce))?(pt=t.charAt(Ce),Ce++):(pt=r,Yt===0&&Ze(Te));pt!==r;)ft.push(pt),_e.test(t.charAt(Ce))?(pt=t.charAt(Ce),Ce++):(pt=r,Yt===0&&Ze(Te));ft!==r?(Tt=$,me=H(),$=me):(Ce=$,$=r)}else Ce=$,$=r;else Ce=$,$=r;return $}function wi(){var $,me;return $=Ce,t.substr(Ce,4)===Je?(me=Je,Ce+=4):(me=r,Yt===0&&Ze(He)),me!==r&&(Tt=$,me=x()),$=me,$}function gs(){var $,me;return $=Ce,t.substr(Ce,4)===w?(me=w,Ce+=4):(me=r,Yt===0&&Ze(S)),me!==r&&(Tt=$,me=y()),$=me,$===r&&($=Ce,t.substr(Ce,5)===F?(me=F,Ce+=5):(me=r,Yt===0&&Ze(z)),me!==r&&(Tt=$,me=X()),$=me),$}function ds(){var $,me,Le,ft;return Yt++,$=Ce,t.charCodeAt(Ce)===34?(me=ie,Ce++):(me=r,Yt===0&&Ze(Se)),me!==r?(t.charCodeAt(Ce)===34?(Le=ie,Ce++):(Le=r,Yt===0&&Ze(Se)),Le!==r?(Tt=$,me=Ne(),$=me):(Ce=$,$=r)):(Ce=$,$=r),$===r&&($=Ce,t.charCodeAt(Ce)===34?(me=ie,Ce++):(me=r,Yt===0&&Ze(Se)),me!==r?(Le=ms(),Le!==r?(t.charCodeAt(Ce)===34?(ft=ie,Ce++):(ft=r,Yt===0&&Ze(Se)),ft!==r?(Tt=$,me=ot(Le),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)),Yt--,$===r&&(me=r,Yt===0&&Ze(Z)),$}function ms(){var $,me,Le;if($=Ce,me=[],Le=_s(),Le!==r)for(;Le!==r;)me.push(Le),Le=_s();else me=r;return me!==r&&(Tt=$,me=dt(me)),$=me,$}function _s(){var $,me,Le,ft,pt,Rt;return jt.test(t.charAt(Ce))?($=t.charAt(Ce),Ce++):($=r,Yt===0&&Ze($t)),$===r&&($=Ce,t.substr(Ce,2)===xt?(me=xt,Ce+=2):(me=r,Yt===0&&Ze(an)),me!==r&&(Tt=$,me=Qr()),$=me,$===r&&($=Ce,t.substr(Ce,2)===mr?(me=mr,Ce+=2):(me=r,Yt===0&&Ze(xr)),me!==r&&(Tt=$,me=Wr()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Vn?(me=Vn,Ce+=2):(me=r,Yt===0&&Ze(Ns)),me!==r&&(Tt=$,me=Ri()),$=me,$===r&&($=Ce,t.substr(Ce,2)===ps?(me=ps,Ce+=2):(me=r,Yt===0&&Ze(io)),me!==r&&(Tt=$,me=Si()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Ls?(me=Ls,Ce+=2):(me=r,Yt===0&&Ze(so)),me!==r&&(Tt=$,me=cc()),$=me,$===r&&($=Ce,t.substr(Ce,2)===cu?(me=cu,Ce+=2):(me=r,Yt===0&&Ze(ap)),me!==r&&(Tt=$,me=lp()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Ms?(me=Ms,Ce+=2):(me=r,Yt===0&&Ze(Dn)),me!==r&&(Tt=$,me=oo()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Os?(me=Os,Ce+=2):(me=r,Yt===0&&Ze(ml)),me!==r&&(Tt=$,me=yl()),$=me,$===r&&($=Ce,t.substr(Ce,2)===ao?(me=ao,Ce+=2):(me=r,Yt===0&&Ze(Kn)),me!==r?(Le=Un(),Le!==r?(ft=Un(),ft!==r?(pt=Un(),pt!==r?(Rt=Un(),Rt!==r?(Tt=$,me=Mn(Le,ft,pt,Rt),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)))))))))),$}function Un(){var $;return Ni.test(t.charAt(Ce))?($=t.charAt(Ce),Ce++):($=r,Yt===0&&Ze(On)),$}function Pn(){var $,me;if(Yt++,$=[],tr.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(Me)),me!==r)for(;me!==r;)$.push(me),tr.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(Me));else $=r;return Yt--,$===r&&(me=r,Yt===0&&Ze(_i)),$}function ys(){var $,me;if(Yt++,$=[],Oa.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(hr)),me!==r)for(;me!==r;)$.push(me),Oa.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(hr));else $=r;return Yt--,$===r&&(me=r,Yt===0&&Ze(ii)),$}function We(){var $,me,Le,ft,pt,Rt;if($=Ce,me=tt(),me!==r){for(Le=[],ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(Rt=tt(),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);ft!==r;)Le.push(ft),ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(Rt=tt(),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);Le!==r?(me=[me,Le],$=me):(Ce=$,$=r)}else Ce=$,$=r;return $}function tt(){var $;return t.substr(Ce,2)===uc?($=uc,Ce+=2):($=r,Yt===0&&Ze(uu)),$===r&&(t.charCodeAt(Ce)===10?($=Ac,Ce++):($=r,Yt===0&&Ze(El)),$===r&&(t.charCodeAt(Ce)===13?($=vA,Ce++):($=r,Yt===0&&Ze(Au)))),$}let It=2,nr=0;if(Cl=a(),Cl!==r&&Ce===t.length)return Cl;throw Cl!==r&&Ce "u"?!0:typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.keys(t).every(e=>iK(t[e])):!1}function DR(t,e,r){if(t===null)return`null
+`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()}
+`;if(typeof t=="string")return`${rK(t)}
+`;if(Array.isArray(t)){if(t.length===0)return`[]
+`;let o=" ".repeat(e);return`
+${t.map(n=>`${o}- ${DR(n,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let[o,a]=t instanceof XD?[t.data,!1]:[t,!0],n=" ".repeat(e),u=Object.keys(o);a&&u.sort((p,h)=>{let E=tK.indexOf(p),I=tK.indexOf(h);return E===-1&&I===-1?p
{var n,u;if(Object.getPrototypeOf(o).toString()==="[object Set]")if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");let A=[...o],p=[...o];if(!r(p,Object.assign(Object.assign({},a),{coercion:void 0})))return!1;let h=()=>p.some((E,I)=>E!==A[I])?new Set(p):o;return a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",iI(a.coercion,o,h)]),!0}else{let A=!0;for(let p of o)if(A=t(p,Object.assign({},a))&&A,!A&&a?.errors==null)break;return A}if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");let A={value:o};return r(o,Object.assign(Object.assign({},a),{coercion:Yu(A,"value")}))?(a.coercions.push([(u=a.p)!==null&&u!==void 0?u:".",iI(a.coercion,o,()=>new Set(A.value))]),!0):!1}return pr(a,`Expected a set (got ${jn(o)})`)}})}function dje(t,e){let r=iP(sP([t,e])),o=oP(e,{keys:t});return Hr({test:(a,n)=>{var u,A,p;if(Object.getPrototypeOf(a).toString()==="[object Map]")if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return pr(n,"Unbound coercion result");let h=[...a],E=[...a];if(!r(E,Object.assign(Object.assign({},n),{coercion:void 0})))return!1;let I=()=>E.some((v,b)=>v[0]!==h[b][0]||v[1]!==h[b][1])?new Map(E):a;return n.coercions.push([(u=n.p)!==null&&u!==void 0?u:".",iI(n.coercion,a,I)]),!0}else{let h=!0;for(let[E,I]of a)if(h=t(E,Object.assign({},n))&&h,!h&&n?.errors==null||(h=e(I,Object.assign(Object.assign({},n),{p:Yp(n,E)}))&&h,!h&&n?.errors==null))break;return h}if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return pr(n,"Unbound coercion result");let h={value:a};return Array.isArray(a)?r(a,Object.assign(Object.assign({},n),{coercion:void 0}))?(n.coercions.push([(A=n.p)!==null&&A!==void 0?A:".",iI(n.coercion,a,()=>new Map(h.value))]),!0):!1:o(a,Object.assign(Object.assign({},n),{coercion:Yu(h,"value")}))?(n.coercions.push([(p=n.p)!==null&&p!==void 0?p:".",iI(n.coercion,a,()=>new Map(Object.entries(h.value)))]),!0):!1}return pr(n,`Expected a map (got ${jn(a)})`)}})}function sP(t,{delimiter:e}={}){let r=yK(t.length);return Hr({test:(o,a)=>{var n;if(typeof o=="string"&&typeof e<"u"&&typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");o=o.split(e),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,o)])}if(!Array.isArray(o))return pr(a,`Expected a tuple (got ${jn(o)})`);let u=r(o,Object.assign({},a));for(let A=0,p=o.length;A
{var n;if(Array.isArray(o)&&typeof a?.coercions<"u")return typeof a?.coercion>"u"?pr(a,"Unbound coercion result"):r(o,Object.assign(Object.assign({},a),{coercion:void 0}))?(o=Object.fromEntries(o),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,o)]),!0):!1;if(typeof o!="object"||o===null)return pr(a,`Expected an object (got ${jn(o)})`);let u=Object.keys(o),A=!0;for(let p=0,h=u.length;p `:`[${b}]`)}o.push(...this.arity.leading.map(u=>`<${u}>`)),this.arity.extra===el?o.push("..."):o.push(...this.arity.extra.map(u=>`[${u}]`)),o.push(...this.arity.trailing.map(u=>`<${u}>`))}return{usage:o.join(" "),options:a}}compile(){if(typeof this.context>"u")throw new Error("Assertion failed: No context attached");let e=CK(),r=cn.InitialNode,o=this.usage().usage,a=this.options.filter(A=>A.required).map(A=>A.nameSet);r=Mc(e,$a()),Jo(e,cn.InitialNode,Hn.StartOfInput,r,["setCandidateState",{candidateUsage:o,requiredOptions:a}]);let n=this.arity.proxy?"always":"isNotOptionLike",u=this.paths.length>0?this.paths:[[]];for(let A of u){let p=r;if(A.length>0){let v=Mc(e,$a());Cy(e,p,v),this.registerOptions(e,v),p=v}for(let v=0;v {var tze=Jp(),rze=_l(),nze=tze(rze,"DataView");Ite.exports=nze});var Dte=_((xTt,vte)=>{var ize=Jp(),sze=_l(),oze=ize(sze,"Promise");vte.exports=oze});var Ste=_((bTt,Pte)=>{var aze=Jp(),lze=_l(),cze=aze(lze,"Set");Pte.exports=cze});var bte=_((kTt,xte)=>{var uze=Jp(),Aze=_l(),fze=uze(Aze,"WeakMap");xte.exports=fze});var qI=_((QTt,Lte)=>{var $N=Bte(),eL=UP(),tL=Dte(),rL=Ste(),nL=bte(),Nte=pd(),Hy=qN(),kte="[object Map]",pze="[object Object]",Qte="[object Promise]",Fte="[object Set]",Tte="[object WeakMap]",Rte="[object DataView]",hze=Hy($N),gze=Hy(eL),dze=Hy(tL),mze=Hy(rL),yze=Hy(nL),hd=Nte;($N&&hd(new $N(new ArrayBuffer(1)))!=Rte||eL&&hd(new eL)!=kte||tL&&hd(tL.resolve())!=Qte||rL&&hd(new rL)!=Fte||nL&&hd(new nL)!=Tte)&&(hd=function(t){var e=Nte(t),r=e==pze?t.constructor:void 0,o=r?Hy(r):"";if(o)switch(o){case hze:return Rte;case gze:return kte;case dze:return Qte;case mze:return Fte;case yze:return Tte}return e});Lte.exports=hd});var Gte=_((FTt,qte)=>{var iL=HP(),Eze=GN(),Cze=Fee(),wze=wte(),Mte=qI(),Ote=Hl(),Ute=OI(),Ize=KP(),Bze=1,_te="[object Arguments]",Hte="[object Array]",XP="[object Object]",vze=Object.prototype,jte=vze.hasOwnProperty;function Dze(t,e,r,o,a,n){var u=Ote(t),A=Ote(e),p=u?Hte:Mte(t),h=A?Hte:Mte(e);p=p==_te?XP:p,h=h==_te?XP:h;var E=p==XP,I=h==XP,v=p==h;if(v&&Ute(t)){if(!Ute(e))return!1;u=!0,E=!1}if(v&&!E)return n||(n=new iL),u||Ize(t)?Eze(t,e,r,o,a,n):Cze(t,e,p,r,o,a,n);if(!(r&Bze)){var b=E&&jte.call(t,"__wrapped__"),C=I&&jte.call(e,"__wrapped__");if(b||C){var T=b?t.value():t,L=C?e.value():e;return n||(n=new iL),a(T,L,r,o,n)}}return v?(n||(n=new iL),wze(t,e,r,o,a,n)):!1}qte.exports=Dze});var Kte=_((TTt,Vte)=>{var Pze=Gte(),Yte=Ju();function Wte(t,e,r,o,a){return t===e?!0:t==null||e==null||!Yte(t)&&!Yte(e)?t!==t&&e!==e:Pze(t,e,r,o,Wte,a)}Vte.exports=Wte});var zte=_((RTt,Jte)=>{var Sze=Kte();function xze(t,e){return Sze(t,e)}Jte.exports=xze});var sL=_((NTt,Xte)=>{var bze=Jp(),kze=function(){try{var t=bze(Object,"defineProperty");return t({},"",{}),t}catch{}}();Xte.exports=kze});var ZP=_((LTt,$te)=>{var Zte=sL();function Qze(t,e,r){e=="__proto__"&&Zte?Zte(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}$te.exports=Qze});var oL=_((MTt,ere)=>{var Fze=ZP(),Tze=Ry();function Rze(t,e,r){(r!==void 0&&!Tze(t[e],r)||r===void 0&&!(e in t))&&Fze(t,e,r)}ere.exports=Rze});var rre=_((OTt,tre)=>{function Nze(t){return function(e,r,o){for(var a=-1,n=Object(e),u=o(e),A=u.length;A--;){var p=u[t?A:++a];if(r(n[p],p,n)===!1)break}return e}}tre.exports=Nze});var ire=_((UTt,nre)=>{var Lze=rre(),Mze=Lze();nre.exports=Mze});var aL=_((GI,jy)=>{var Oze=_l(),lre=typeof GI=="object"&&GI&&!GI.nodeType&&GI,sre=lre&&typeof jy=="object"&&jy&&!jy.nodeType&&jy,Uze=sre&&sre.exports===lre,ore=Uze?Oze.Buffer:void 0,are=ore?ore.allocUnsafe:void 0;function _ze(t,e){if(e)return t.slice();var r=t.length,o=are?are(r):new t.constructor(r);return t.copy(o),o}jy.exports=_ze});var $P=_((_Tt,ure)=>{var cre=YN();function Hze(t){var e=new t.constructor(t.byteLength);return new cre(e).set(new cre(t)),e}ure.exports=Hze});var lL=_((HTt,Are)=>{var jze=$P();function qze(t,e){var r=e?jze(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}Are.exports=qze});var eS=_((jTt,fre)=>{function Gze(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r>/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w>>S}},"/\\/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w&S}},"\\//2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w|S}},"xor/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w^S}},"rem/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return S?w%S:x.error.evaluation("zero_division",y.__call_indicator)}},"mod/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return S?w-parseInt(w/S)*S:x.error.evaluation("zero_division",y.__call_indicator)}},"max/2":{type_args:null,type_result:null,fn:function(w,S,y){return Math.max(w,S)}},"min/2":{type_args:null,type_result:null,fn:function(w,S,y){return Math.min(w,S)}}}},directive:{"dynamic/1":function(w,S){var y=S.args[0];if(x.type.is_variable(y))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_compound(y)||y.indicator!=="//2")w.throw_error(x.error.type("predicate_indicator",y,S.indicator));else if(x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1]))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_atom(y.args[0]))w.throw_error(x.error.type("atom",y.args[0],S.indicator));else if(!x.type.is_integer(y.args[1]))w.throw_error(x.error.type("integer",y.args[1],S.indicator));else{var F=S.args[0].args[0].id+"/"+S.args[0].args[1].value;w.session.public_predicates[F]=!0,w.session.rules[F]||(w.session.rules[F]=[])}},"multifile/1":function(w,S){var y=S.args[0];x.type.is_variable(y)?w.throw_error(x.error.instantiation(S.indicator)):!x.type.is_compound(y)||y.indicator!=="//2"?w.throw_error(x.error.type("predicate_indicator",y,S.indicator)):x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1])?w.throw_error(x.error.instantiation(S.indicator)):x.type.is_atom(y.args[0])?x.type.is_integer(y.args[1])?w.session.multifile_predicates[S.args[0].args[0].id+"/"+S.args[0].args[1].value]=!0:w.throw_error(x.error.type("integer",y.args[1],S.indicator)):w.throw_error(x.error.type("atom",y.args[0],S.indicator))},"set_prolog_flag/2":function(w,S){var y=S.args[0],F=S.args[1];x.type.is_variable(y)||x.type.is_variable(F)?w.throw_error(x.error.instantiation(S.indicator)):x.type.is_atom(y)?x.type.is_flag(y)?x.type.is_value_flag(y,F)?x.type.is_modifiable_flag(y)?w.session.flag[y.id]=F:w.throw_error(x.error.permission("modify","flag",y)):w.throw_error(x.error.domain("flag_value",new H("+",[y,F]),S.indicator)):w.throw_error(x.error.domain("prolog_flag",y,S.indicator)):w.throw_error(x.error.type("atom",y,S.indicator))},"use_module/1":function(w,S){var y=S.args[0];if(x.type.is_variable(y))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_term(y))w.throw_error(x.error.type("term",y,S.indicator));else if(x.type.is_module(y)){var F=y.args[0].id;e(w.session.modules,F)===-1&&w.session.modules.push(F)}},"char_conversion/2":function(w,S){var y=S.args[0],F=S.args[1];x.type.is_variable(y)||x.type.is_variable(F)?w.throw_error(x.error.instantiation(S.indicator)):x.type.is_character(y)?x.type.is_character(F)?y.id===F.id?delete w.session.__char_conversion[y.id]:w.session.__char_conversion[y.id]=F.id:w.throw_error(x.error.type("character",F,S.indicator)):w.throw_error(x.error.type("character",y,S.indicator))},"op/3":function(w,S){var y=S.args[0],F=S.args[1],z=S.args[2];if(x.type.is_variable(y)||x.type.is_variable(F)||x.type.is_variable(z))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_integer(y))w.throw_error(x.error.type("integer",y,S.indicator));else if(!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,S.indicator));else if(!x.type.is_atom(z))w.throw_error(x.error.type("atom",z,S.indicator));else if(y.value<0||y.value>1200)w.throw_error(x.error.domain("operator_priority",y,S.indicator));else if(z.id===",")w.throw_error(x.error.permission("modify","operator",z,S.indicator));else if(z.id==="|"&&(y.value<1001||F.id.length!==3))w.throw_error(x.error.permission("modify","operator",z,S.indicator));else if(["fy","fx","yf","xf","xfx","yfx","xfy"].indexOf(F.id)===-1)w.throw_error(x.error.domain("operator_specifier",F,S.indicator));else{var X={prefix:null,infix:null,postfix:null};for(var Z in w.session.__operators)if(!!w.session.__operators.hasOwnProperty(Z)){var ie=w.session.__operators[Z][z.id];ie&&(e(ie,"fx")!==-1&&(X.prefix={priority:Z,type:"fx"}),e(ie,"fy")!==-1&&(X.prefix={priority:Z,type:"fy"}),e(ie,"xf")!==-1&&(X.postfix={priority:Z,type:"xf"}),e(ie,"yf")!==-1&&(X.postfix={priority:Z,type:"yf"}),e(ie,"xfx")!==-1&&(X.infix={priority:Z,type:"xfx"}),e(ie,"xfy")!==-1&&(X.infix={priority:Z,type:"xfy"}),e(ie,"yfx")!==-1&&(X.infix={priority:Z,type:"yfx"}))}var Se;switch(F.id){case"fy":case"fx":Se="prefix";break;case"yf":case"xf":Se="postfix";break;default:Se="infix";break}if(((X.prefix&&Se==="prefix"||X.postfix&&Se==="postfix"||X.infix&&Se==="infix")&&X[Se].type!==F.id||X.infix&&Se==="postfix"||X.postfix&&Se==="infix")&&y.value!==0)w.throw_error(x.error.permission("create","operator",z,S.indicator));else return X[Se]&&(Ee(w.session.__operators[X[Se].priority][z.id],F.id),w.session.__operators[X[Se].priority][z.id].length===0&&delete w.session.__operators[X[Se].priority][z.id]),y.value>0&&(w.session.__operators[y.value]||(w.session.__operators[y.value.toString()]={}),w.session.__operators[y.value][z.id]||(w.session.__operators[y.value][z.id]=[]),w.session.__operators[y.value][z.id].push(F.id)),!0}}},predicate:{"op/3":function(w,S,y){x.directive["op/3"](w,y)&&w.success(S)},"current_op/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2],Z=[];for(var ie in w.session.__operators)for(var Se in w.session.__operators[ie])for(var Ne=0;Ne