Compare commits
5 Commits
79d37ccabd
...
1.0.1
Author | SHA1 | Date | |
---|---|---|---|
2d10b81650
|
|||
ea9a60558f
|
|||
35979fa743
|
|||
b91a183626
|
|||
32b9578bb5
|
@@ -20,7 +20,7 @@ Currently supported pride flags:
|
||||
- Lesbian pride flag
|
||||
|
||||
more flags to follow soon!</description>
|
||||
<version>0.1.0</version>
|
||||
<version>1.0.0</version>
|
||||
<licence>gpl3</licence>
|
||||
<author mail="transcaffeine@finally.coffee" homepage="https://github.com/finally-coffee-nextcloud-pride-flags">transcaffeine</author>
|
||||
<namespace>PrideFlags</namespace>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
return [
|
||||
'routes' => [
|
||||
|
@@ -9,6 +9,11 @@ Currently supported "targets":
|
||||
Currently supported pride flags:
|
||||
- Original 6 color rainbow pride flag
|
||||
- Trans pride flag
|
||||
- Pansexual pride flag
|
||||
- Non-binary pride flag
|
||||
- Bisexual pride flag
|
||||
- Asexual pride flag
|
||||
- Lesbian pride flag
|
||||
|
||||
more flags to follow soon!",
|
||||
"license": "GPL-3.0-or-later",
|
||||
|
@@ -14,11 +14,10 @@
|
||||
fill: var(--image-background-pride-button-gradient);
|
||||
}
|
||||
|
||||
/*
|
||||
body {
|
||||
--image-background-pride-button: var(--image-background-pride-trans);
|
||||
--image-background-pride-folder: var(--image-background-pride-pride);
|
||||
--image-background-pride-button-gradient: var(--image-background-pride-gradient-pride);
|
||||
--image-background-pride-folder-gradient: var(--image-background-pride-gradient-trans);
|
||||
#app-navigation ul > li.active .material-design-icon__svg,
|
||||
.button-vue--vue-primary .material-design-icon__svg,
|
||||
.preview-card__header .material-design-icon__svg,
|
||||
.profile__primary-action-button .material-design-icon__svg,
|
||||
.app-navigation-entry.active .material-design-icon__svg {
|
||||
fill: var(--color-primary-element-text);
|
||||
}
|
||||
*/
|
||||
|
@@ -16,20 +16,21 @@ use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||
|
||||
class SettingsController extends Controller {
|
||||
public function __construct($appName, IRequest $request, private AppSettings $appSettings) {
|
||||
|
||||
public function __construct($appName, IRequest $request, private AppSettings $appSettings, private $userId) {
|
||||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
||||
#[NoAdminRequired]
|
||||
#[NoCSRFRequired]
|
||||
public function get(): JSONResponse {
|
||||
return $this->makeJSONResponse(fn () => $this->appSettings->getAll());
|
||||
return $this->makeJSONResponse(fn () => $this->appSettings->getAll($this->userId));
|
||||
}
|
||||
|
||||
#[NoAdminRequired]
|
||||
public function set(string $folderVariant, string $buttonVariant): JSONResponse {
|
||||
$this->appSettings->set($folderVariant, $buttonVariant);
|
||||
return $this->makeJSONResponse(fn () => $this->appSettings->getAll());
|
||||
$this->appSettings->set($this->userId, $folderVariant, $buttonVariant);
|
||||
return $this->makeJSONResponse(fn () => $this->appSettings->getAll($this->userId));
|
||||
}
|
||||
|
||||
protected function makeJSONResponse(Closure $closure): JSONResponse {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
namespace OCA\PrideFlags\Settings;
|
||||
|
||||
@@ -12,23 +12,23 @@ class AppSettings {
|
||||
public function __construct(private IConfig $config) {
|
||||
}
|
||||
|
||||
public function getStringSetting(string $key, string $default = ''): string {
|
||||
return $this->config->getAppValue(AppConstants::APP_ID, $key) ?: $default;
|
||||
public function getStringSetting($userId, string $key, string $default = ''): string {
|
||||
return $this->config->getUserValue(AppConstants::APP_ID, $userId, $key) ?: $default;
|
||||
}
|
||||
|
||||
public function setStringSetting(string $key, string $value): void {
|
||||
$this->config->setAppValue(AppConstants::APP_ID, $key, $value);
|
||||
public function setStringSetting($userId, string $key, string $value): void {
|
||||
$this->config->setUserValue(AppConstants::APP_ID, $userId, $key, $value);
|
||||
}
|
||||
|
||||
public function getAll(): array {
|
||||
public function getAll($userId): array {
|
||||
return [
|
||||
AppSettings::FOLDER_VARIANT => $this->getStringSetting(AppSettings::FOLDER_VARIANT, 'pride'),
|
||||
AppSettings::BUTTON_VARIANT => $this->getStringSetting(AppSettings::BUTTON_VARIANT, 'trans'),
|
||||
AppSettings::FOLDER_VARIANT => $this->getStringSetting($userId, AppSettings::FOLDER_VARIANT, 'pride'),
|
||||
AppSettings::BUTTON_VARIANT => $this->getStringSetting($userId, AppSettings::BUTTON_VARIANT, 'trans'),
|
||||
];
|
||||
}
|
||||
|
||||
public function set($folder, $button): void {
|
||||
$this->setStringSetting(AppSettings::FOLDER_VARIANT, $folder);
|
||||
$this->setStringSetting(AppSettings::BUTTON_VARIANT, $button);
|
||||
public function set($userId, $folder, $button): void {
|
||||
$this->setStringSetting($userId, AppSettings::FOLDER_VARIANT, $folder);
|
||||
$this->setStringSetting($userId, AppSettings::BUTTON_VARIANT, $button);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pride_flags",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"engines": {
|
||||
"node": "^20.0.0",
|
||||
|
Reference in New Issue
Block a user