From a59155e3d6c3ebf80c781acf2fce7a87eaa19ea8 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Sun, 30 Mar 2025 14:36:27 +0200 Subject: [PATCH 1/4] meta: exclude bin and vendor-bin in release script --- bin/nextcloud-app-release.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/nextcloud-app-release.sh b/bin/nextcloud-app-release.sh index c890d77..c90b2b9 100755 --- a/bin/nextcloud-app-release.sh +++ b/bin/nextcloud-app-release.sh @@ -21,7 +21,10 @@ traperr() { } trap traperr ERR -mv .git ../nextcloud-pride-flags-git +mkdir ../nextcloud-pride-flags-tmp +mv .git ../nextcloud-pride-flags-tmp/.git +mv bin ../nextcloud-pride-flags-tmp/bin +mv vendor-bin ../nextcloud-pride-flags-tmp/vendor-bin sudo docker run --hostname nc31.local \ -e NEXTCLOUD_ADMIN_USER=admin \ @@ -41,12 +44,14 @@ sudo docker exec -it ${CONTAINER_NAME} php occ integrity:sign-app \ sudo docker stop "${CONTAINER_NAME}" sudo docker rm "${CONTAINER_NAME}" -mv ../nextcloud-pride-flags-git .git +mv ../nextcloud-pride-flags-tmp/.git .git +mv ../nextcloud-pride-flags-tmp/bin bin +mv ../nextcloud-pride-flags-tmp/vendor-bin vendor-bin echo "App $APP_NAME signed @ ${VERSION}. Commit the appinfo/signatures.json now and press enter." read -p "Press Enter to continue" < /dev/tty -tar --exclude-vcs -czvf "${TARBALL}" "$REPO" +tar --exclude-vcs --exclude='./bin' --exclude='./vendor-bin' -czvf "${TARBALL}" "$REPO" # verify content echo "Tarball '${TARBALL}' content:" -- 2.47.2 From 744077f0fda2dc9c41e6f07bb591646b5f5a958e Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Sat, 29 Mar 2025 21:30:42 +0100 Subject: [PATCH 2/4] refactor: use string-backed enum for variant selection --- lib/AppConstants.php | 10 ++++++++++ lib/Settings/AppSettings.php | 9 +++++++-- templates/settings.php | 23 +++++++++-------------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/lib/AppConstants.php b/lib/AppConstants.php index e2be724..dbd34d7 100644 --- a/lib/AppConstants.php +++ b/lib/AppConstants.php @@ -6,4 +6,14 @@ namespace OCA\PrideFlags; abstract class AppConstants { public const APP_ID = 'pride_flags'; + public enum Variants: string { + case PRIDE = "Pride"; + case TRANS = "Trans Pride"; + case PAN = "Pansexual Pride"; + case BI = "Bisexual Pride"; + case ASEXUAL = "Asexual Pride"; + case LESBIAN = "Lesbian Pride"; + case NONBINARY = "Non-binary Pride"; + case NONE = "No customisation"; + } } diff --git a/lib/Settings/AppSettings.php b/lib/Settings/AppSettings.php index 158112b..cb1cd6b 100644 --- a/lib/Settings/AppSettings.php +++ b/lib/Settings/AppSettings.php @@ -18,11 +18,16 @@ class AppSettings { } public function setStringSetting($userId, string $key, string $value): void { - $this->config->setUserValue(AppConstants::APP_ID, $userId, $key, $value); + // Check for valid Variant here + if (AppConstants\Variants::tryFrom($value) != null) { + $this->config->setUserValue(AppConstants::APP_ID, $userId, $key, $value); + } } public function setAppStringSetting(string $key, string $value): void { - $this->config->setAppValue(AppConstants::APP_ID, $key, $value); + if (AppConstants\Variants::tryFrom($value) != null) { + $this->config->setAppValue(AppConstants::APP_ID, $key, $value); + } } public function getAll($userId): array { diff --git a/templates/settings.php b/templates/settings.php index 91529d7..1182d08 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -1,5 +1,8 @@