Compare commits

..

No commits in common. "82be3d5f135cb16c22add62e3bd92bdd79f0184e" and "4fcf9b1684e1636562b044d38b6690437363f266" have entirely different histories.

2 changed files with 30 additions and 22 deletions

View file

@ -8,20 +8,27 @@ mkdir -p /app/data/storage /run/peertube/cache /run/peertube/npm /tmp/peertube
cd /app/code/server
migrate_ldap_to_oidc() {
USERS_TO_MIGRATE=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"user\" u WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'")
echo "==> Migrating users to OIDC";
echo " Users to migrate: ${USERS_TO_MIGRATE}"
if [ ${USERS_TO_MIGRATE} -gt 0 ]; then
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "UPDATE \"user\" SET \"pluginAuth\"='peertube-plugin-auth-openid-connect' WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'"
fi
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
OIDC_PLUIGIN_INSTALLED=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"plugin\" WHERE name='auth-openid-connect'")
if [ ${OIDC_PLUIGIN_INSTALLED} -eq 0 ]; then
install_oidc
fi
LDAP_PLUGIN_INSTALLED=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"plugin\" WHERE name='auth-ldap'")
if [ ${LDAP_PLUGIN_INSTALLED} -gt 0 ]; then
echo "==> Uninstalling LDAP plugin"
gosu cloudron:cloudron npm run plugin:uninstall -- -n peertube-plugin-auth-ldap
USERS_TO_MIGRATE=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"user\" u WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'")
echo "==> Migrating users to OIDC";
echo " Users to migrate: ${USERS_TO_MIGRATE}"
if [ ${USERS_TO_MIGRATE} -gt 0 ]; then
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "UPDATE \"user\" SET \"pluginAuth\"='peertube-plugin-auth-openid-connect' WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'"
fi
echo "==> Deleting LDAP settings"
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "DELETE FROM \"plugin\" WHERE name='auth-ldap'"
LDAP_PLUGIN_INSTALLED=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"plugin\" WHERE name='auth-ldap'")
if [ ${LDAP_PLUGIN_INSTALLED} -gt 0 ]; then
echo "==> Uninstalling LDAP plugin"
gosu cloudron:cloudron npm run plugin:uninstall -- -n peertube-plugin-auth-ldap
echo "==> Deleting LDAP settings"
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "DELETE FROM \"plugin\" WHERE name='auth-ldap'"
fi
fi
}
@ -131,11 +138,9 @@ if [[ ! -f "/app/data/production.yaml" ]]; then
first_time_setup
else
update_config
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
install_oidc
migrate_ldap_to_oidc
update_oidc
fi
migrate_ldap_to_oidc
[[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]] && update_oidc
fi
echo "==> Configuring nginx"

View file

@ -123,16 +123,19 @@ describe('Application life cycle test', function () {
async function completeSetup() {
let button;
// await browser.executeScript('localStorage.clear();');
await browser.get(`https://${app.fqdn}`);
await browser.sleep(2000);
await waitForElement(By.xpath('//a[contains(text(), "Configure my instance")]'));
await browser.findElement(By.xpath('//a[contains(text(), "Configure my instance")]')).click(); // this opens a new window
if (await browser.findElements(By.xpath('//a[contains(text(), "Configure my instance")]')).then(found => !!found.length)) {
// await waitForElement(By.xpath('//a[contains(text(), "Configure my instance")]'));
await browser.findElement(By.xpath('//a[contains(text(), "Configure my instance")]')).click(); // this opens a new window
let say_cmd = await getOS() == "Darwin" ? "say" : "spd-say";
execSync(`${say_cmd} "Close the newly opened configuration tab."`);
let say_cmd = await getOS() == "Darwin" ? "say" : "spd-say";
execSync(`${say_cmd} "Close the newly opened configuration tab."`);
await rl.question('Is tab closed? ');
await rl.question('Is tab closed? ');
}
}
async function uploadVideo() {