mirror of
https://git.cloudron.io/cloudron/mastodon-app.git
synced 2024-05-19 09:38:07 +00:00
Compare commits
31 commits
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
7439769e52 | |||
2a87a826c4 | |||
dd4bf3e639 | |||
f7d9238818 |
100
CHANGELOG
100
CHANGELOG
|
@ -371,3 +371,103 @@
|
|||
* Fix missing HTML sanitization in translation API (CVE-2023-42452, GHSA-2693-xr3m-jhqr)
|
||||
* Fix incorrect domain name normalization (CVE-2023-42451, GHSA-v3xf-c9qf-j667)
|
||||
|
||||
[1.12.0]
|
||||
* Update Mastodon to 4.2.0
|
||||
* [Full changelog](https://github.com/mastodon/mastodon/releases/tag/v4.2.0)
|
||||
* Add “Privacy and reach” tab in profile settings (Gargron, ClearlyClaire)
|
||||
* This reorganized scattered privacy and reach settings to a single place, as well as improve their wording.
|
||||
* Add display of out-of-band hashtags in the web interface (Gargron, arbolitoloco1, ClearlyClaire, ClearlyClaire, ClearlyClaire, Gargron, ClearlyClaire)
|
||||
* Add role badges to the web interface (ClearlyClaire, Gargron)
|
||||
* Add ability to pick domains to forward reports to using the forward_to_domains parameter in POST /api/v1/reports (ClearlyClaire, ClearlyClaire)
|
||||
* The forward_to_domains REST API parameter is a list of strings. If it is empty or omitted, the previous behavior is maintained.
|
||||
* The forward parameter still needs to be set for forward_to_domains to be taken into account.
|
||||
* The forwarded-to domains can only include that of the original author and people being replied to.
|
||||
* Add forwarding of reported replies to servers being replied to (Gargron, ClearlyClaire)
|
||||
* Add ONE_CLICK_SSO_LOGIN environment variable to directly link to the Single-Sign On provider if there is only one sign up method available (CSDUMMI, ClearlyClaire, CSDUMMI, ClearlyClaire)
|
||||
* Add webhook templating (Gargron)
|
||||
* 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)
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
"description": "file://DESCRIPTION.md",
|
||||
"changelog": "file://CHANGELOG",
|
||||
"tagline": "Federated social network",
|
||||
"version": "1.11.11",
|
||||
"upstreamVersion": "4.1.9",
|
||||
"version": "1.13.1",
|
||||
"upstreamVersion": "4.2.8",
|
||||
"healthCheckPath": "/about",
|
||||
"httpPort": 8000,
|
||||
"memoryLimit": 1610612736,
|
||||
|
@ -16,7 +16,7 @@
|
|||
"postgresql": {},
|
||||
"redis": {},
|
||||
"sendmail": {},
|
||||
"ldap": {},
|
||||
"oidc": { "loginRedirectUri": "/auth/auth/openid_connect/callback" },
|
||||
"scheduler": {
|
||||
"cleanup": {
|
||||
"schedule": "11 01 * * *",
|
||||
|
|
11
Dockerfile
11
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
|
||||
WORKDIR /app/code
|
||||
|
@ -20,27 +20,28 @@ RUN apt-get update && \
|
|||
# install rbenv since we need ruby 3.0.4
|
||||
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 RBENV_ROOT /home/cloudron/rbenv
|
||||
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 -
|
||||
|
||||
# install specific ruby version (https://github.com/mastodon/mastodon/blob/main/Dockerfile)
|
||||
ARG RUBY_VERSION=3.0.4
|
||||
RUN rbenv install ${RUBY_VERSION}
|
||||
# this allows cloudron user to access ruby
|
||||
RUN chmod o+rx /root
|
||||
ENV PATH /root/.rbenv/versions/${RUBY_VERSION}/bin:$PATH
|
||||
ENV PATH ${RBENV_ROOT}/versions/${RUBY_VERSION}/bin:$PATH
|
||||
|
||||
RUN gem install --no-document bundler
|
||||
|
||||
ENV RAILS_ENV production
|
||||
ENV NODE_ENV production
|
||||
|
||||
ARG VERSION=4.1.9
|
||||
ARG VERSION=4.2.8
|
||||
|
||||
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 without 'development test' && \
|
||||
bundle config --local set silence_root_warning true && \
|
||||
bundle install && \
|
||||
bundle clean --force && \
|
||||
rm -rf ~/.bundle /usr/local/bundle/cache && \
|
||||
yarn install --pure-lockfile
|
||||
|
||||
# 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>
|
||||
**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.
|
||||
</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>
|
||||
|
|
20
env.template
20
env.template
|
@ -32,20 +32,22 @@ SMTP_AUTH_METHOD=plain
|
|||
SMTP_OPENSSL_VERIFY_MODE=none
|
||||
|
||||
# SSO configuration
|
||||
LDAP_ENABLED=
|
||||
LDAP_HOST=
|
||||
LDAP_PORT=
|
||||
LDAP_BASE=
|
||||
LDAP_BIND_DN=
|
||||
LDAP_PASSWORD=
|
||||
LDAP_UID=username
|
||||
LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(mail=%{email}))
|
||||
LDAP_METHOD=plain
|
||||
OIDC_ENABLED=
|
||||
OIDC_DISPLAY_NAME=
|
||||
OIDC_ISSUER=
|
||||
OIDC_CLIENT_ID=
|
||||
OIDC_CLIENT_SECRET=
|
||||
OIDC_REDIRECT_URI=
|
||||
OIDC_DISCOVERY=
|
||||
OIDC_SCOPE=
|
||||
OIDC_UID_FIELD=
|
||||
|
||||
# Application secrets
|
||||
SECRET_KEY_BASE=
|
||||
OTP_SECRET=
|
||||
|
||||
UPDATE_CHECK_URL=
|
||||
|
||||
# Optionally change default language
|
||||
# DEFAULT_LOCALE=de
|
||||
|
||||
|
|
27
start.sh
27
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" \
|
||||
-i /app/data/env.production
|
||||
|
||||
if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
|
||||
sed -e "s/LDAP_ENABLED=.*/LDAP_ENABLED=true/g" \
|
||||
-e "s/LDAP_HOST=.*/LDAP_HOST=${CLOUDRON_LDAP_SERVER}/g" \
|
||||
-e "s/LDAP_PORT=.*/LDAP_PORT=${CLOUDRON_LDAP_PORT}/g" \
|
||||
-e "s/LDAP_BASE=.*/LDAP_BASE=${CLOUDRON_LDAP_USERS_BASE_DN}/g" \
|
||||
-e "s/LDAP_BIND_DN=.*/LDAP_BIND_DN=${CLOUDRON_LDAP_BIND_DN}/g" \
|
||||
-e "s/LDAP_PASSWORD=.*/LDAP_PASSWORD=${CLOUDRON_LDAP_BIND_PASSWORD}/g" \
|
||||
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
|
||||
echo "==> Setting up OIDC"
|
||||
sed -e "s/OIDC_ENABLED=.*/OIDC_ENABLED=true/g" \
|
||||
-e "s/OIDC_DISPLAY_NAME=.*/OIDC_DISPLAY_NAME=Cloudron/g" \
|
||||
-e "s/OIDC_ISSUER=.*/OIDC_ISSUER=${CLOUDRON_OIDC_ISSUER//\//\\\/}/g" \
|
||||
-e "s/OIDC_CLIENT_ID=.*/OIDC_CLIENT_ID=${CLOUDRON_OIDC_CLIENT_ID}/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
|
||||
else
|
||||
sed -e "s/LDAP_ENABLED=.*/LDAP_ENABLED=false/g" -i /app/data/env.production
|
||||
fi
|
||||
|
||||
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"
|
||||
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"
|
||||
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')"
|
||||
|
@ -67,6 +70,10 @@ else
|
|||
HOME=/app/data SAFETY_ASSURED=1 bundle exec rails db:migrate
|
||||
fi
|
||||
|
||||
if ! grep -q UPDATE_CHECK_URL /app/data/env.production; then
|
||||
echo -e "\nUPDATE_CHECK_URL=" >> /app/data/env.production
|
||||
fi
|
||||
|
||||
chown -R cloudron:cloudron /tmp/mastodon /run/mastodon
|
||||
|
||||
if [[ "$(stat -c '%U' /app/data)" != "cloudron" ]]; then
|
||||
|
|
724
test/package-lock.json
generated
724
test/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -10,10 +10,10 @@
|
|||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^10.2.0",
|
||||
"selenium-webdriver": "^4.12.0"
|
||||
"mocha": "^10.3.0",
|
||||
"selenium-webdriver": "^4.18.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"chromedriver": "^117.0.1"
|
||||
"chromedriver": "^122.0.3"
|
||||
}
|
||||
}
|
||||
|
|
139
test/test.js
139
test/test.js
|
@ -30,6 +30,7 @@ describe('Application life cycle test', function () {
|
|||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||
|
||||
let browser, app;
|
||||
var athenticated_by_oidc = false;
|
||||
let username = process.env.USERNAME;
|
||||
let password = process.env.PASSWORD;
|
||||
let manifest = require('../CloudronManifest.json');
|
||||
|
@ -42,6 +43,15 @@ describe('Application life cycle test', function () {
|
|||
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) {
|
||||
await browser.wait(until.elementLocated(selector), TEST_TIMEOUT);
|
||||
}
|
||||
|
@ -52,10 +62,10 @@ describe('Application life cycle test', function () {
|
|||
}
|
||||
|
||||
async function checkRegistration(mode) {
|
||||
if (mode === 'none') {
|
||||
if (mode === 'none') {
|
||||
await browser.get('https://' + app.fqdn);
|
||||
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")]'));
|
||||
} else if (mode === 'open') {
|
||||
await browser.get('https://' + app.fqdn + '/auth/sign_up');
|
||||
|
@ -65,85 +75,66 @@ describe('Application life cycle test', function () {
|
|||
|
||||
async function login(username, password) {
|
||||
await browser.get('https://' + app.fqdn + '/auth/sign_in'); // there is also separate login page at /users/sign_in
|
||||
await browser.wait(until.elementLocated(By.xpath('//button[contains(text(), "Log in")]')), TEST_TIMEOUT);
|
||||
await visible(By.xpath('//button[contains(text(), "Log in")]'));
|
||||
await browser.findElement(By.id('user_email')).sendKeys(username);
|
||||
await browser.findElement(By.id('user_password')).sendKeys(password);
|
||||
await browser.findElement(By.xpath('//button[contains(text(), "Log in")]')).click();
|
||||
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() {
|
||||
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.findElement(By.id('logout')).click();
|
||||
await browser.wait(until.elementLocated(By.id('user_email')), TEST_TIMEOUT);
|
||||
await visible(By.id('user_email'));
|
||||
}
|
||||
|
||||
async function skipTutorial() {
|
||||
await browser.get('https://' + app.fqdn + '/web/start');
|
||||
await browser.wait(until.elementLocated(By.xpath('//button/span[text() = "Done"]')), TEST_TIMEOUT);
|
||||
await browser.findElement(By.xpath('//button/span[text() = "Done"]')).click();
|
||||
await browser.sleep(5000); // can be wizard or timeline at this point
|
||||
await browser.wait(until.elementLocated(By.xpath('//span[text() = "See some suggestions"]')), TEST_TIMEOUT);
|
||||
await browser.sleep(5000);
|
||||
async function dismissHelp() {
|
||||
await browser.get('https://' + app.fqdn + '/home');
|
||||
await visible(By.xpath('//button[@title = "Dismiss"]'));
|
||||
await browser.findElement(By.xpath('//button[@title ="Dismiss"]')).click();
|
||||
}
|
||||
|
||||
async function checkTimeline() {
|
||||
await browser.get('https://' + app.fqdn + '/home');
|
||||
await browser.sleep(2000);
|
||||
await browser.wait(until.elementLocated(By.xpath('//span[text() = "See some suggestions"]')), TEST_TIMEOUT);
|
||||
await visible(By.xpath('//span[contains(text(), "Your home timeline is empty")]'));
|
||||
}
|
||||
|
||||
function getAppInfo() {
|
||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
const inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
app = inspect.apps.filter(function (a) { return a.location === LOCATION || a.location === LOCATION + '2'; })[0];
|
||||
expect(app).to.be.an('object');
|
||||
}
|
||||
|
||||
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 skip tutorial', skipTutorial);
|
||||
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
|
||||
it('install app (no sso)', function () { execSync('cloudron install --no-sso --location ' + LOCATION, EXEC_ARGS); });
|
||||
it('can get app information', getAppInfo);
|
||||
|
||||
it('has registration open', checkRegistration.bind(null, 'open'));
|
||||
it('has registration open', checkRegistration.bind(null, 'none'));
|
||||
let testPassword;
|
||||
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' });
|
||||
|
@ -165,10 +156,50 @@ describe('Application life cycle test', function () {
|
|||
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
|
||||
it('can install app', function () { execSync('cloudron install --appstore-id ' + manifest.id + ' --location ' + LOCATION, EXEC_ARGS); });
|
||||
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 update', async function () {
|
||||
|
@ -176,7 +207,7 @@ describe('Application life cycle test', function () {
|
|||
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); });
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue