mirror of
https://git.cloudron.io/cloudron/mastodon-app.git
synced 2024-06-10 09:19:28 +00:00
Compare commits
31 commits
Author | SHA1 | Date | |
---|---|---|---|
95403b326b | |||
870718ad69 | |||
95c055755e | |||
f22270c707 | |||
de786e59ed | |||
0c77e8c32a | |||
6fa11cf195 | |||
b72b058f5e | |||
77f9fa9a63 | |||
56bcb395dc | |||
a24ad995de | |||
f8c84b6ef5 | |||
a08af787d7 | |||
e556c856f1 | |||
25292a86b4 | |||
146b5ac17e | |||
fdc4e20c77 | |||
886f27ec9a | |||
941292bf52 | |||
b4f7038f79 | |||
b77a74978c | |||
816ac7c8ba | |||
31ab0ce6c5 | |||
6d274756a3 | |||
246c44e1c3 | |||
46cf00f343 | |||
2938d2cc2f | |||
1814d12d23 | |||
0e6a4c6ec3 | |||
4036cfa1a7 | |||
27d68b5c35 |
92
CHANGELOG
92
CHANGELOG
|
@ -387,3 +387,95 @@
|
||||||
* Add webhook templating (Gargron)
|
* Add webhook templating (Gargron)
|
||||||
* Add webhooks for local status.created, status.updated, account.updated and report.updated (VyrCossont, VyrCossont, VyrCossont)
|
* Add webhooks for local status.created, status.updated, account.updated and report.updated (VyrCossont, VyrCossont, VyrCossont)
|
||||||
|
|
||||||
|
[1.12.1]
|
||||||
|
* Update Mastodon to 4.2.1
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.1)
|
||||||
|
* Add redirection on /deck URLs for logged-out users (ClearlyClaire)
|
||||||
|
* Add support for v4.2.0 migrations to tootctl maintenance fix-duplicates (ClearlyClaire)
|
||||||
|
* Change some worker lock TTLs to be shorter-lived (ClearlyClaire)
|
||||||
|
* Change user archive export allowed period from 7 days to 6 days (suddjian)
|
||||||
|
|
||||||
|
[1.12.2]
|
||||||
|
* Update Mastodon to 4.2.2
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.2)
|
||||||
|
* Change dismissed banners to be stored server-side (ClearlyClaire)
|
||||||
|
* Change GIF max matrix size error to explicitly mention GIF files (ClearlyClaire)
|
||||||
|
* Change Follow activities delivery to bypass availability check (ShadowJonathan)
|
||||||
|
* Change single-column navigation notice to be displayed outside of the logo container (renchap, renchap)
|
||||||
|
* Change Content-Security-Policy to be tighter on media paths (ClearlyClaire)
|
||||||
|
* Change post language code to include country code when relevant (gunchleoc, ClearlyClaire)
|
||||||
|
* Fix upper border radius of onboarding columns (ClearlyClaire)
|
||||||
|
* Fix incoming status creation date not being restricted to standard ISO8601 (ClearlyClaire, ClearlyClaire)
|
||||||
|
* Fix some posts from threads received out-of-order sometimes not being inserted into timelines (ClearlyClaire)
|
||||||
|
* Fix posts from force-sensitized accounts being able to trend (ClearlyClaire)
|
||||||
|
* Fix error when trying to delete already-deleted file with OpenStack Swift (ClearlyClaire)
|
||||||
|
* Fix batch attachment deletion when using OpenStack Swift (ClearlyClaire)
|
||||||
|
* Fix processing LDSigned activities from actors with unknown public keys (ClearlyClaire)
|
||||||
|
* Fix error and incorrect URLs in /api/v1/accounts/:id/featured_tags for remote accounts (ClearlyClaire)
|
||||||
|
* Fix report processing notice not mentioning the report number when performing a custom action (ClearlyClaire)
|
||||||
|
* Fix handling of inLanguage attribute in preview card processing (ClearlyClaire)
|
||||||
|
* Fix own posts being removed from home timeline when unfollowing a used hashtag (kmycode)
|
||||||
|
* Fix some link anchors being recognized as hashtags (ClearlyClaire, ClearlyClaire)
|
||||||
|
* Fix format-dependent redirects being cached regardless of requested format (ClearlyClaire)
|
||||||
|
|
||||||
|
[1.12.3]
|
||||||
|
* Update Mastodon to 4.2.3
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.3)
|
||||||
|
* Fix dependency on json-canonicalization version that has been made unavailable since last release
|
||||||
|
|
||||||
|
[1.12.4]
|
||||||
|
* Update Mastodon to 4.2.4
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.4)
|
||||||
|
* Add rate-limit of TOTP authentication attempts at controller level (ClearlyClaire)
|
||||||
|
* Fix error when processing remote files with unusually long names (ClearlyClaire)
|
||||||
|
* Fix processing of compacted single-item JSON-LD collections (ClearlyClaire)
|
||||||
|
* Retry 401 errors on replies fetching (ShadowJonathan)
|
||||||
|
* Fix RecordNotUnique errors in LinkCrawlWorker (tribela)
|
||||||
|
* Fix Mastodon not correctly processing HTTP Signatures with query strings (ClearlyClaire, ClearlyClaire)
|
||||||
|
|
||||||
|
[1.12.5]
|
||||||
|
* Update Mastodon to 4.2.5
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.5)
|
||||||
|
* Fix insufficient origin validation (CVE-2024-23832, GHSA-3fjr-858r-92rw)
|
||||||
|
|
||||||
|
[1.12.6]
|
||||||
|
* Update Mastodon to 4.2.6
|
||||||
|
* This release is an important security release fixing several security issue.
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.6)
|
||||||
|
* Change external authentication behavior to never reattach a new identity to an existing user by default (GHSA-vm39-j3vx-pch3)
|
||||||
|
* Update the nokogiri dependency (see GHSA-xc9x-jj77-9p9j)
|
||||||
|
* Disable administrative Doorkeeper routes (ThisIsMissEm)
|
||||||
|
* Fix ongoing streaming sessions not being invalidated when applications get deleted in some cases (GHSA-7w3c-p9j8-mq3x)
|
||||||
|
* Update the sidekiq-unique-jobs dependency (see GHSA-cmh9-rx85-xj38)
|
||||||
|
|
||||||
|
[1.13.0]
|
||||||
|
* Update Mastodon to 4.2.7
|
||||||
|
* This release is an important security release fixing several security issue.
|
||||||
|
* With this package release, the app moves from LDAP authentication to OpenID Connect
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.7)
|
||||||
|
* Fix OmniAuth tests and edge cases in error handling (ClearlyClaire, ClearlyClaire)
|
||||||
|
* Fix new installs by upgrading to the latest release of the nsa gem, instead of a no longer existing commit (mjankowski)
|
||||||
|
* Fix insufficient checking of remote posts (GHSA-jhrq-qvrm-qr36)
|
||||||
|
|
||||||
|
[1.13.1]
|
||||||
|
* Update Mastodon to 4.2.8
|
||||||
|
* This update changes registrations to be closed by default.
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.8)
|
||||||
|
* Add hourly task to automatically require approval for new registrations in the absence of moderators (ClearlyClaire, ClearlyClaire)
|
||||||
|
* In order to prevent future abandoned Mastodon servers from being used for spam, harassment and other malicious activity, Mastodon will now automatically switch new user registrations to require moderator approval whenever they are left open and no activity (including non-moderation actions from apps) from any logged-in user with permission to access moderation reports has been detected in a full week.
|
||||||
|
* When this happens, users with the permission to change server settings will receive an email notification.
|
||||||
|
* This feature is disabled when EMAIL_DOMAIN_ALLOWLIST is used, and can also be disabled with DISABLE_AUTOMATIC_SWITCHING_TO_APPROVED_REGISTRATIONS=true.
|
||||||
|
* Change registrations to be closed by default on new installations (ClearlyClaire)
|
||||||
|
* If you are running a server and never changed your registrations mode from the default, updating will automatically close your registrations.
|
||||||
|
* Simply re-enable them through the administration interface or using tootctl settings registrations open if you want to enable them again.
|
||||||
|
* Fix processing of remote ActivityPub actors making use of Link objects as Image url (ClearlyClaire)
|
||||||
|
* Fix link verifications when page size exceeds 1MB (ClearlyClaire)
|
||||||
|
|
||||||
|
[1.13.2]
|
||||||
|
* Update Mastodon to 4.2.9
|
||||||
|
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.9)
|
||||||
|
* Update dependencies
|
||||||
|
* Fix private mention filtering (GHSA-5fq7-3p3j-9vrf)
|
||||||
|
* Fix password change endpoint not being rate-limited (GHSA-q3rg-xx5v-4mxh)
|
||||||
|
* Add hardening around rate-limit bypass (GHSA-c2r5-cfqr-c553)
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
"description": "file://DESCRIPTION.md",
|
"description": "file://DESCRIPTION.md",
|
||||||
"changelog": "file://CHANGELOG",
|
"changelog": "file://CHANGELOG",
|
||||||
"tagline": "Federated social network",
|
"tagline": "Federated social network",
|
||||||
"version": "1.12.0",
|
"version": "1.13.2",
|
||||||
"upstreamVersion": "4.2.0",
|
"upstreamVersion": "4.2.9",
|
||||||
"healthCheckPath": "/about",
|
"healthCheckPath": "/about",
|
||||||
"httpPort": 8000,
|
"httpPort": 8000,
|
||||||
"memoryLimit": 1610612736,
|
"memoryLimit": 1610612736,
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
"postgresql": {},
|
"postgresql": {},
|
||||||
"redis": {},
|
"redis": {},
|
||||||
"sendmail": {},
|
"sendmail": {},
|
||||||
"ldap": {},
|
"oidc": { "loginRedirectUri": "/auth/auth/openid_connect/callback" },
|
||||||
"scheduler": {
|
"scheduler": {
|
||||||
"cleanup": {
|
"cleanup": {
|
||||||
"schedule": "11 01 * * *",
|
"schedule": "11 01 * * *",
|
||||||
|
|
17
Dockerfile
17
Dockerfile
|
@ -1,4 +1,4 @@
|
||||||
FROM cloudron/base:4.0.0@sha256:31b195ed0662bdb06a6e8a5ddbedb6f191ce92e8bee04c03fb02dd4e9d0286df
|
FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4
|
||||||
|
|
||||||
RUN mkdir -p /app/code /app/pkg
|
RUN mkdir -p /app/code /app/pkg
|
||||||
WORKDIR /app/code
|
WORKDIR /app/code
|
||||||
|
@ -17,30 +17,31 @@ RUN apt-get update && \
|
||||||
libidn11-dev libicu-dev libjemalloc-dev && \
|
libidn11-dev libicu-dev libjemalloc-dev && \
|
||||||
rm -rf /var/cache/apt /var/lib/apt/lists
|
rm -rf /var/cache/apt /var/lib/apt/lists
|
||||||
|
|
||||||
# install rbenv since we need ruby 3.0.4
|
# install rbenv since we need ruby 3.2.3
|
||||||
RUN mkdir -p /usr/local/rbenv && curl -LSs "https://github.com/rbenv/rbenv/archive/refs/tags/v1.2.0.tar.gz" | tar -xz -C /usr/local/rbenv --strip-components 1 -f -
|
RUN mkdir -p /usr/local/rbenv && curl -LSs "https://github.com/rbenv/rbenv/archive/refs/tags/v1.2.0.tar.gz" | tar -xz -C /usr/local/rbenv --strip-components 1 -f -
|
||||||
ENV PATH /usr/local/rbenv/bin:$PATH
|
ENV PATH /usr/local/rbenv/bin:$PATH
|
||||||
RUN mkdir -p "$(rbenv root)"/plugins/ruby-build && curl -LSs "https://github.com/rbenv/ruby-build/archive/refs/tags/v20221101.tar.gz" | tar -xz -C "$(rbenv root)"/plugins/ruby-build --strip-components 1 -f -
|
ENV RBENV_ROOT /home/cloudron/rbenv
|
||||||
|
RUN mkdir -p "$(rbenv root)"/plugins/ruby-build && curl -LSs "https://github.com/rbenv/ruby-build/archive/refs/tags/v20240530.1.tar.gz" | tar -xz -C "$(rbenv root)"/plugins/ruby-build --strip-components 1 -f -
|
||||||
|
|
||||||
# install specific ruby version (https://github.com/mastodon/mastodon/blob/main/Dockerfile)
|
# install specific ruby version (https://github.com/mastodon/mastodon/blob/main/Dockerfile)
|
||||||
ARG RUBY_VERSION=3.0.4
|
ARG RUBY_VERSION=3.2.3
|
||||||
RUN rbenv install ${RUBY_VERSION}
|
RUN rbenv install ${RUBY_VERSION}
|
||||||
# this allows cloudron user to access ruby
|
ENV PATH ${RBENV_ROOT}/versions/${RUBY_VERSION}/bin:$PATH
|
||||||
RUN chmod o+rx /root
|
|
||||||
ENV PATH /root/.rbenv/versions/${RUBY_VERSION}/bin:$PATH
|
|
||||||
|
|
||||||
RUN gem install --no-document bundler
|
RUN gem install --no-document bundler
|
||||||
|
|
||||||
ENV RAILS_ENV production
|
ENV RAILS_ENV production
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
|
|
||||||
ARG VERSION=4.2.0
|
ARG VERSION=4.2.9
|
||||||
|
|
||||||
RUN curl -L https://github.com/tootsuite/mastodon/archive/v${VERSION}.tar.gz | tar -xz --strip-components 1 -f - && \
|
RUN curl -L https://github.com/tootsuite/mastodon/archive/v${VERSION}.tar.gz | tar -xz --strip-components 1 -f - && \
|
||||||
bundle config --local set deployment 'true' && \
|
bundle config --local set deployment 'true' && \
|
||||||
bundle config --local set without 'development test' && \
|
bundle config --local set without 'development test' && \
|
||||||
bundle config --local set silence_root_warning true && \
|
bundle config --local set silence_root_warning true && \
|
||||||
bundle install && \
|
bundle install && \
|
||||||
|
bundle clean --force && \
|
||||||
|
rm -rf ~/.bundle /usr/local/bundle/cache && \
|
||||||
yarn install --pure-lockfile
|
yarn install --pure-lockfile
|
||||||
|
|
||||||
# secret keys are not built into assets, so precompiling is safe to do here
|
# secret keys are not built into assets, so precompiling is safe to do here
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
Accounts are created with the username and the subdomain under which this app is installed e.g. `@$CLOUDRON-USERNAME@$CLOUDRON-APP-FQDN`. Mastodon does not allow changing the domain part of the account later. See [the docs](https://docs.cloudron.io/apps/mastodon/#federation) for more information, if you want to change this domain.
|
Accounts are created with the username and the subdomain under which this app is installed e.g. `@$CLOUDRON-USERNAME@$CLOUDRON-APP-FQDN`.
|
||||||
|
Mastodon does not allow changing the domain part of the account later.
|
||||||
|
See [the docs](https://docs.cloudron.io/apps/mastodon/#federation) for more information, f you want to change this domain.
|
||||||
|
|
||||||
<sso>
|
<sso>
|
||||||
**NOTE:**
|
**NOTE:**
|
||||||
|
@ -7,3 +9,9 @@ Accounts are created with the username and the subdomain under which this app is
|
||||||
* External registration [does not work well](https://github.com/mastodon/mastodon/issues/20655) when Cloudron user management is enabled.
|
* External registration [does not work well](https://github.com/mastodon/mastodon/issues/20655) when Cloudron user management is enabled.
|
||||||
</sso>
|
</sso>
|
||||||
|
|
||||||
|
<nosso>
|
||||||
|
**NOTE:**
|
||||||
|
* Open registration is disabled by default. To enable this, see the [docs](https://docs.cloudron.io/apps/mastodon/#registration)
|
||||||
|
|
||||||
|
* To add an initial account follow those [instructions](https://docs.cloudron.io/apps/mastodon/#adding-users)
|
||||||
|
</nosso>
|
||||||
|
|
18
env.template
18
env.template
|
@ -32,15 +32,15 @@ SMTP_AUTH_METHOD=plain
|
||||||
SMTP_OPENSSL_VERIFY_MODE=none
|
SMTP_OPENSSL_VERIFY_MODE=none
|
||||||
|
|
||||||
# SSO configuration
|
# SSO configuration
|
||||||
LDAP_ENABLED=
|
OIDC_ENABLED=
|
||||||
LDAP_HOST=
|
OIDC_DISPLAY_NAME=
|
||||||
LDAP_PORT=
|
OIDC_ISSUER=
|
||||||
LDAP_BASE=
|
OIDC_CLIENT_ID=
|
||||||
LDAP_BIND_DN=
|
OIDC_CLIENT_SECRET=
|
||||||
LDAP_PASSWORD=
|
OIDC_REDIRECT_URI=
|
||||||
LDAP_UID=username
|
OIDC_DISCOVERY=
|
||||||
LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(mail=%{email}))
|
OIDC_SCOPE=
|
||||||
LDAP_METHOD=plain
|
OIDC_UID_FIELD=
|
||||||
|
|
||||||
# Application secrets
|
# Application secrets
|
||||||
SECRET_KEY_BASE=
|
SECRET_KEY_BASE=
|
||||||
|
|
23
start.sh
23
start.sh
|
@ -30,16 +30,19 @@ sed -e "s/DB_HOST=.*/DB_HOST=${CLOUDRON_POSTGRESQL_HOST}/g" \
|
||||||
-e "s/WEB_DOMAIN=.*/WEB_DOMAIN=${CLOUDRON_APP_DOMAIN}/g" \
|
-e "s/WEB_DOMAIN=.*/WEB_DOMAIN=${CLOUDRON_APP_DOMAIN}/g" \
|
||||||
-i /app/data/env.production
|
-i /app/data/env.production
|
||||||
|
|
||||||
if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
|
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
|
||||||
sed -e "s/LDAP_ENABLED=.*/LDAP_ENABLED=true/g" \
|
echo "==> Setting up OIDC"
|
||||||
-e "s/LDAP_HOST=.*/LDAP_HOST=${CLOUDRON_LDAP_SERVER}/g" \
|
sed -e "s/OIDC_ENABLED=.*/OIDC_ENABLED=true/g" \
|
||||||
-e "s/LDAP_PORT=.*/LDAP_PORT=${CLOUDRON_LDAP_PORT}/g" \
|
-e "s/OIDC_DISPLAY_NAME=.*/OIDC_DISPLAY_NAME=Cloudron/g" \
|
||||||
-e "s/LDAP_BASE=.*/LDAP_BASE=${CLOUDRON_LDAP_USERS_BASE_DN}/g" \
|
-e "s/OIDC_ISSUER=.*/OIDC_ISSUER=${CLOUDRON_OIDC_ISSUER//\//\\\/}/g" \
|
||||||
-e "s/LDAP_BIND_DN=.*/LDAP_BIND_DN=${CLOUDRON_LDAP_BIND_DN}/g" \
|
-e "s/OIDC_CLIENT_ID=.*/OIDC_CLIENT_ID=${CLOUDRON_OIDC_CLIENT_ID}/g" \
|
||||||
-e "s/LDAP_PASSWORD=.*/LDAP_PASSWORD=${CLOUDRON_LDAP_BIND_PASSWORD}/g" \
|
-e "s/OIDC_CLIENT_SECRET=.*/OIDC_CLIENT_SECRET=${CLOUDRON_OIDC_CLIENT_SECRET}/g" \
|
||||||
|
-e "s/OIDC_REDIRECT_URI=.*/OIDC_REDIRECT_URI=${CLOUDRON_APP_ORIGIN//\//\\\/}\/auth\/auth\/openid_connect\/callback/g" \
|
||||||
|
-e "s/OIDC_DISCOVERY=.*/OIDC_DISCOVERY=true/g" \
|
||||||
|
-e "s/OIDC_SCOPE=.*/OIDC_SCOPE=openid,profile,email/g" \
|
||||||
|
-e "s/OIDC_UID_FIELD=.*/OIDC_UID_FIELD=sub/g" \
|
||||||
|
-e "s/OIDC_SECURITY_ASSUME_EMAIL_IS_VERIFIED=.*/OIDC_SECURITY_ASSUME_EMAIL_IS_VERIFIED=true/g" \
|
||||||
-i /app/data/env.production
|
-i /app/data/env.production
|
||||||
else
|
|
||||||
sed -e "s/LDAP_ENABLED=.*/LDAP_ENABLED=false/g" -i /app/data/env.production
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /run/mastodon/Gemfile.lock && cp /app/code/Gemfile.lock.original /run/mastodon/Gemfile.lock
|
rm -f /run/mastodon/Gemfile.lock && cp /app/code/Gemfile.lock.original /run/mastodon/Gemfile.lock
|
||||||
|
@ -57,7 +60,7 @@ if grep -q "^SECRET_KEY_BASE=$" /app/data/env.production; then
|
||||||
echo "==> Init database"
|
echo "==> Init database"
|
||||||
HOME=/app/data SAFETY_ASSURED=1 bundle exec rails db:schema:load db:seed
|
HOME=/app/data SAFETY_ASSURED=1 bundle exec rails db:schema:load db:seed
|
||||||
|
|
||||||
if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
|
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
|
||||||
echo "Disabling registration by default"
|
echo "Disabling registration by default"
|
||||||
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} \
|
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} \
|
||||||
-c "INSERT INTO settings (var, value) VALUES ('registrations_mode', 'none')"
|
-c "INSERT INTO settings (var, value) VALUES ('registrations_mode', 'none')"
|
||||||
|
|
862
test/package-lock.json
generated
862
test/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -10,10 +10,10 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"expect.js": "^0.3.1",
|
"expect.js": "^0.3.1",
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.4.0",
|
||||||
"selenium-webdriver": "^4.12.0"
|
"selenium-webdriver": "^4.21.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chromedriver": "^117.0.1"
|
"chromedriver": "^125.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
117
test/test.js
117
test/test.js
|
@ -30,6 +30,7 @@ describe('Application life cycle test', function () {
|
||||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||||
|
|
||||||
let browser, app;
|
let browser, app;
|
||||||
|
var athenticated_by_oidc = false;
|
||||||
let username = process.env.USERNAME;
|
let username = process.env.USERNAME;
|
||||||
let password = process.env.PASSWORD;
|
let password = process.env.PASSWORD;
|
||||||
let manifest = require('../CloudronManifest.json');
|
let manifest = require('../CloudronManifest.json');
|
||||||
|
@ -42,6 +43,15 @@ describe('Application life cycle test', function () {
|
||||||
browser.quit();
|
browser.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function sleep(millis) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, millis));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function waitForElement(elem) {
|
||||||
|
await browser.wait(until.elementLocated(elem), TEST_TIMEOUT);
|
||||||
|
await browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
async function exists(selector) {
|
async function exists(selector) {
|
||||||
await browser.wait(until.elementLocated(selector), TEST_TIMEOUT);
|
await browser.wait(until.elementLocated(selector), TEST_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +65,7 @@ describe('Application life cycle test', function () {
|
||||||
if (mode === 'none') {
|
if (mode === 'none') {
|
||||||
await browser.get('https://' + app.fqdn);
|
await browser.get('https://' + app.fqdn);
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
await browser.findElement(By.xpath('//div[@class="sign-in-banner"]/descendant::button/span[contains(text(), "Create account")]')).click();
|
await browser.findElement(By.xpath('//div[@class="sign-in-banner"]/descendant::button/span[contains(text(), "Create account")] | //div[@class="sign-in-banner"]/descendant::a/span[contains(text(), "Create account")]')).click();
|
||||||
await visible(By.xpath('//span[contains(text()[2], "is currently not possible")]'));
|
await visible(By.xpath('//span[contains(text()[2], "is currently not possible")]'));
|
||||||
} else if (mode === 'open') {
|
} else if (mode === 'open') {
|
||||||
await browser.get('https://' + app.fqdn + '/auth/sign_up');
|
await browser.get('https://' + app.fqdn + '/auth/sign_up');
|
||||||
|
@ -72,6 +82,28 @@ describe('Application life cycle test', function () {
|
||||||
await browser.sleep(3000); // can be wizard or timeline at this point
|
await browser.sleep(3000); // can be wizard or timeline at this point
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loginOIDC(username, password) {
|
||||||
|
browser.manage().deleteAllCookies();
|
||||||
|
await browser.get(`https://${app.fqdn}/auth/sign_in`);
|
||||||
|
await browser.sleep(4000);
|
||||||
|
|
||||||
|
await browser.findElement(By.xpath('//a[contains(@class, "button") and text()="Cloudron"]')).click();
|
||||||
|
await browser.sleep(4000);
|
||||||
|
|
||||||
|
if (!athenticated_by_oidc) {
|
||||||
|
await waitForElement(By.xpath('//input[@name="username"]'));
|
||||||
|
await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(username);
|
||||||
|
await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password);
|
||||||
|
await browser.sleep(2000);
|
||||||
|
await browser.findElement(By.id('loginSubmitButton')).click();
|
||||||
|
await browser.sleep(2000);
|
||||||
|
|
||||||
|
athenticated_by_oidc = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await waitForElement(By.xpath('//a[contains(., "Edit profile")] | //strong[text()="Successfully authenticated from Cloudron account."]'));
|
||||||
|
}
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await browser.get('https://' + app.fqdn + '/settings/preferences/appearance'); // there is also separate login page at /users/sign_in
|
await browser.get('https://' + app.fqdn + '/settings/preferences/appearance'); // there is also separate login page at /users/sign_in
|
||||||
await browser.wait(until.elementLocated(By.id('logout')), TEST_TIMEOUT);
|
await browser.wait(until.elementLocated(By.id('logout')), TEST_TIMEOUT);
|
||||||
|
@ -97,49 +129,12 @@ describe('Application life cycle test', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
||||||
it('install app', function () { execSync('cloudron install --location ' + LOCATION, EXEC_ARGS); });
|
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
|
||||||
it('registration is disabled', checkRegistration.bind(null, 'none'));
|
|
||||||
it('can LDAP login', login.bind(null, username, password));
|
|
||||||
it('can dismiss help', dismissHelp);
|
|
||||||
it('can see timeline', checkTimeline);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
|
||||||
it('restore app', function () {
|
|
||||||
const backups = JSON.parse(execSync('cloudron backup list --raw'));
|
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
|
||||||
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
|
|
||||||
getAppInfo();
|
|
||||||
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can LDAP login', login.bind(null, username, password));
|
|
||||||
it('can see timeline', checkTimeline);
|
|
||||||
|
|
||||||
it('can restart app', function () { execSync('cloudron restart --app ' + app.id, EXEC_ARGS); });
|
|
||||||
it('can see timeline', checkTimeline);
|
|
||||||
|
|
||||||
it('move to different location', async function () {
|
|
||||||
await browser.get('about:blank');
|
|
||||||
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS);
|
|
||||||
});
|
|
||||||
it('can get app information', getAppInfo);
|
|
||||||
|
|
||||||
it('can LDAP login', login.bind(null, username, password));
|
|
||||||
it('can see timeline', checkTimeline);
|
|
||||||
|
|
||||||
it('uninstall app', async function () {
|
|
||||||
await browser.get('about:blank');
|
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
|
||||||
});
|
|
||||||
|
|
||||||
// No SSO
|
// No SSO
|
||||||
it('install app (no sso)', function () { execSync('cloudron install --no-sso --location ' + LOCATION, EXEC_ARGS); });
|
it('install app (no sso)', function () { execSync('cloudron install --no-sso --location ' + LOCATION, EXEC_ARGS); });
|
||||||
it('can get app information', getAppInfo);
|
it('can get app information', getAppInfo);
|
||||||
|
|
||||||
it('has registration open', checkRegistration.bind(null, 'open'));
|
it('has registration open', checkRegistration.bind(null, 'none'));
|
||||||
let testPassword;
|
let testPassword;
|
||||||
it('create a user with CLI', function () {
|
it('create a user with CLI', function () {
|
||||||
let output = execSync('cloudron exec --app ' + LOCATION + ' -- bin/tootctl accounts create test --email=test@cloudron.io', { cwd: path.resolve(__dirname, '..'), encoding: 'utf8' });
|
let output = execSync('cloudron exec --app ' + LOCATION + ' -- bin/tootctl accounts create test --email=test@cloudron.io', { cwd: path.resolve(__dirname, '..'), encoding: 'utf8' });
|
||||||
|
@ -161,10 +156,50 @@ describe('Application life cycle test', function () {
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// SSO
|
||||||
|
it('install app (sso)', function () { execSync('cloudron install --location ' + LOCATION, EXEC_ARGS); });
|
||||||
|
|
||||||
|
it('can get app information', getAppInfo);
|
||||||
|
it('registration is disabled', checkRegistration.bind(null, 'none'));
|
||||||
|
it('can OIDC login', loginOIDC.bind(null, username, password));
|
||||||
|
it('can dismiss help', dismissHelp);
|
||||||
|
it('can see timeline', checkTimeline);
|
||||||
|
it('can logout', logout);
|
||||||
|
|
||||||
|
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
||||||
|
it('restore app', function () {
|
||||||
|
const backups = JSON.parse(execSync('cloudron backup list --raw'));
|
||||||
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
|
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
|
||||||
|
getAppInfo();
|
||||||
|
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can OIDC login', loginOIDC.bind(null, username, password));
|
||||||
|
it('can see timeline', checkTimeline);
|
||||||
|
|
||||||
|
it('can restart app', function () { execSync('cloudron restart --app ' + app.id, EXEC_ARGS); });
|
||||||
|
it('can see timeline', checkTimeline);
|
||||||
|
|
||||||
|
it('move to different location', async function () {
|
||||||
|
await browser.get('about:blank');
|
||||||
|
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS);
|
||||||
|
});
|
||||||
|
it('can get app information', getAppInfo);
|
||||||
|
|
||||||
|
it('can OIDC login', loginOIDC.bind(null, username, password));
|
||||||
|
it('can see timeline', checkTimeline);
|
||||||
|
|
||||||
|
it('uninstall app', async function () {
|
||||||
|
await browser.get('about:blank');
|
||||||
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
|
});
|
||||||
|
|
||||||
// test update
|
// test update
|
||||||
it('can install app', function () { execSync('cloudron install --appstore-id ' + manifest.id + ' --location ' + LOCATION, EXEC_ARGS); });
|
it('can install app', function () { execSync('cloudron install --appstore-id ' + manifest.id + ' --location ' + LOCATION, EXEC_ARGS); });
|
||||||
it('can get app information', getAppInfo);
|
it('can get app information', getAppInfo);
|
||||||
it('can LDAP login', login.bind(null, username, password));
|
// needs to be changed to loginOIDC on the next release
|
||||||
|
it('can OIDC login', loginOIDC.bind(null, username, password));
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can update', async function () {
|
it('can update', async function () {
|
||||||
|
@ -172,7 +207,7 @@ describe('Application life cycle test', function () {
|
||||||
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);
|
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can LDAP login', login.bind(null, username, password));
|
it('can OIDC login', loginOIDC.bind(null, username, password));
|
||||||
|
|
||||||
it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
|
it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue