Compare commits
11 Commits
0.1.0-rc.2
...
main
Author | SHA1 | Date | |
---|---|---|---|
0be543c467 | |||
e41ed5dd76 | |||
88767289c4 | |||
1ac7c8f69a | |||
6b53ccb88e | |||
2d10b81650 | |||
ea9a60558f | |||
35979fa743 | |||
b91a183626 | |||
32b9578bb5 | |||
dabd367369 |
12
README.md
12
README.md
@ -4,3 +4,15 @@ A plugin to add more pride flags to your Nextcloud!
|
||||
|
||||
The app supports setting pride-flags for various UI elements of your
|
||||
Nextcloud per-user, in the user settings section.
|
||||
|
||||
![Nextcloud showing various elements in pan, trans, lesbian and rainbow pride flags](img/pride_flag_variants.png)
|
||||
|
||||
## Currently supported pride flags
|
||||
|
||||
- 'rainbow' pride flag
|
||||
- trans pride flag
|
||||
- pansexual pride flag
|
||||
- non-binary pride flag
|
||||
- bisexual pride flag
|
||||
- asexual pride flag
|
||||
- lesbian pride flag
|
||||
|
@ -13,18 +13,26 @@ 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!</description>
|
||||
<version>0.1.0</version>
|
||||
<version>1.1.1</version>
|
||||
<licence>gpl3</licence>
|
||||
<author mail="transcaffeine@finally.coffee" homepage="https://github.com/finally-coffee-nextcloud-pride-flags">transcaffeine</author>
|
||||
<author mail="transcaffeine@finally.coffee" homepage="https://github.com/finally-coffee/nextcloud-pride-flags">transcaffeine</author>
|
||||
<namespace>PrideFlags</namespace>
|
||||
<category>customization</category>
|
||||
<bugs>https://github.com/finally-coffee/nextcloud-pride-flags/issues</bugs>
|
||||
<screenshot>https://raw.githubusercontent.com/finally-coffee/nextcloud-pride-flags/main/img/pride_flag_variants.png</screenshot>
|
||||
<dependencies>
|
||||
<nextcloud min-version="26" max-version="29"/>
|
||||
<nextcloud min-version="28" max-version="30"/>
|
||||
</dependencies>
|
||||
<settings>
|
||||
<admin-section>OCA\PrideFlags\Settings\AdminSection</admin-section>
|
||||
<admin>OCA\PrideFlags\Settings\AdminSettings</admin>
|
||||
<personal-section>OCA\PrideFlags\Settings\PersonalSection</personal-section>
|
||||
<personal>OCA\PrideFlags\Settings\PersonalSettings</personal>
|
||||
</settings>
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
return [
|
||||
'routes' => [
|
||||
['name' => 'settings#get', 'url' => '/settings', 'verb' => 'GET'],
|
||||
['name' => 'settings#set', 'url' => '/settings', 'verb' => 'POST'],
|
||||
['name' => 'settings#getGlobal', 'url' => '/settings/global', 'verb' => 'GET'],
|
||||
['name' => 'settings#setGlobal', 'url' => '/settings/global', 'verb' => 'POST'],
|
||||
]
|
||||
];
|
||||
|
36
appinfo/signature.json
Normal file
36
appinfo/signature.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"hashes": {
|
||||
"CHANGELOG.md": "1fc8374d175fd50d275f223b60686861ee85ea93e15bfe723c50e49ea1ae1c8fe4a1731a84d16f1ad2edea71312a50f76b6f70ad990a240fe474b26444ee06da",
|
||||
"CODE_OF_CONDUCT.md": "79d6ec5e748e72fe192dd00b2c73ab849edc45cc50afffde00556ac164c783a305c5f035c2f42864558f43b6ed242111c5bc1535bcc060f57e469366711f15ff",
|
||||
"LICENSE.md": "bfb959226672571ef73e232607a7f7279af2bab2d7253bfd7f28e19dae7ede4637ce3d1225cd95b26881e4bedd14f3a7861629e5dadce24acedfafe5401fdb14",
|
||||
"README.md": "8e09e33145760e0f9f2e666a4c739511224867662c8d1a82e9ea49b1bcdd3a73fc270f97284372a0853cce3eff1c8d37c4a7993ca595ace9220ce154715e14b8",
|
||||
"appinfo\/info.xml": "56e9f24f2931f53ee7c428ed05bc61f56ad27892d12a19f18cdcec9d98c548ac1cfc56bb72e02fe2551d8c77d4867b1738f35afd4e278454310b5d8ef1582508",
|
||||
"appinfo\/routes.php": "063d70ee1c16c287d821164cead2c91e97411b1b02f078034d249dfa60ae947b602ce052b6fa051ae6e73b4a9b4d61a29aad3f310c1e16b39b1546521967d1e9",
|
||||
"composer.json": "26491fea6a8b5bd0b8f5510d25b6d35dded7de21ea9264b3b22bbda1b43a8846b43978992d543d01f97b029681f3bf2fcb277cf7c60d79792f7e4091ca1afbcb",
|
||||
"css\/pride.css": "a038418ee78042c0037b6cb22224c9ab5abae6feb6645f5b952f2656bff25851509f87e4776ba1e47347fcbc1dd8a0193fbaf4a1962fe8e0274d157d431ededa",
|
||||
"img\/pride_flag_variants.png": "1487267bd98cd175de957bdb55705667c0887f4a48c57808a1dfaa7f86c5e72245b39d1438d01af38bdea522d8d8f72e4d8708977a0d21bc92e35c157736626b",
|
||||
"js\/pride-settings-global.js": "8a3f9c0a09b14ea6e6e00cb28aae62964b202c764a75d678342a7e3a377134d55c7ec9bf2fb068104b681df4ceb67da348ad1fd562bc78b12c425ab889ce7436",
|
||||
"js\/pride-settings.js": "81a6d9ab205ccfc0f1a5ae6111301401af09aa6517dd40211e88351a55f62e1b22cd13942f12d3eb14e8e72cdd70453574fd357dcc6ab4b99505537a018be2ab",
|
||||
"js\/pride.js": "f3f850ff8db4205e2f6504742f7259636b462df64047d2ab9739193333a00fc375a684080f087bb5d7e42387186248cce058d1d6360f35d5919d9cc716209310",
|
||||
"lib\/AppConstants.php": "8ec88d84fd2d87c9862aa7761228f927ae3725ea0820feb3e04e44f142a9f0f2974f7f97a076309aa1128e4fb510a26b32307bfc4b47bf56ffcef4952fecc639",
|
||||
"lib\/AppInfo\/Application.php": "6b40646e8df0abc2e32403ab0417b7b244ac93bcd1cffdc94fd9a5bd9498abaa3108eddcf8ef1d52710c8146035784a0a2b034de6c4b1701a3ac49f81e2bfeb6",
|
||||
"lib\/Controller\/SettingsController.php": "153365a950353a03914b1bc20dc6e23dc223b50feb173f37b5f05f8ff90b13f7a7711ec6b1547652869aa55884a04365bb1d604d989abbfa327567d9db1408c0",
|
||||
"lib\/Settings\/AdminSection.php": "80baac4566a681ba0bd5141cb21299be1049fbcc944cfe33d1ea10e8103dfc8b064100bbfba75d0c63cc6f10aed3cbf4293d3ab2620cbc5ceef55bee5049752a",
|
||||
"lib\/Settings\/AdminSettings.php": "bb46351c3d81acfb5299d24e0c7495b48697f00764018de530b9ab02366e8f815834df2eac031a1db2aad3fdde891ed0afd23b10915e3b8d918ca5d4e2b4f880",
|
||||
"lib\/Settings\/AppSettings.php": "85bce86e18e1987fdd2779e66f90a92713bd676743928bfa4a0a7612fa32b1949c955db963d6dc553ab30ab167f018b841b13a268290514c8b56b0194b07408b",
|
||||
"lib\/Settings\/PersonalSection.php": "afd3df8e9cbb1461f03dc20f389270a0418a5e126b3b3f130a8c2389d49f4048c45a9e3d9412428da0ed938e0a6c6b295bda5d6c4818c8241d35bd84f3b7f9b8",
|
||||
"lib\/Settings\/PersonalSettings.php": "6412edc1d3d63a76b8c44dfd954de377331bacdd36318ad84c8eb83ab42a35724e288440a390981d8eb1d8c45f7c77adaf262aba6881c29992fa8b56c97cce48",
|
||||
"openapi.json": "88b7b7594c588dfa0ef73fe7f63f78ab2823b7175ed746bb54691f99fb424e028f34a942160d967a36c02e06907d1b700c886f2bf25c1789098eb0b895ff4983",
|
||||
"package.json": "9c407ce45905980003eacd15dbf7798cf4af88a96f1b905653291b69e8ff60449c435b906ee5f5945e2f3a9fc0c8d260e01ae2f04cf6f9d3b2e98150cc068b08",
|
||||
"psalm.xml": "1d0e5ca734ca979d8d088e5440486e4b148dcd57d52c5733883bcf650b8641b93559828109ad22ee3da288c7a3414f987263f6ffadc940576cd3c0c64a575395",
|
||||
"stylelint.config.js": "5d09ed0f9ee75fd69a3dd8127af0fe485021319795ff077b9de4ab8f42c42bce0ab5a6bfc83114ab87c341a9bc50ccb9baeb9db0506b1914f91389c543631aa9",
|
||||
"templates\/server-settings.php": "d98eb5cd9bc324216d3957c291900c872d4767778ab61024d2d7a0afd8807d301d95b85fa13d60ed52e613b6bacbfec4f420f14e7cbe8d2eccc29f3419bd8194",
|
||||
"templates\/settings.php": "77f78f17e330fa1fc41997cb9586cd9eda974505003730201ea3a98a2c6ab2684d3b85b55f49e836769aff7fbbaef6ceeba5ea9bbb825178fc683a1a03f7ea8b",
|
||||
"vendor-bin\/cs-fixer\/composer.json": "5072a95c57d2bf02e310f9f2604eb01de003dbdaec656f0fb68d34250754a7431eef2baf3056364a9b7129d3ec08bc1cb68a21f1defa61bba90aa0b4b70c50de",
|
||||
"vendor-bin\/openapi-extractor\/composer.json": "aad0275d639f44d89f4f495ca8f248ed089a948d7aeed2602432f163cf23bb8a6c3f8eee7446c7c20ca1febd6e1a364da090075cc2b288ce22cb010627441b4c",
|
||||
"vendor-bin\/phpunit\/composer.json": "ba4520b430d60a61ba9a236e3064453ce4895bd7d76931f049b2dbdeb174f52f763ef6cf1e645b5743364d592ba5b2e84837611661e9b52a01a738c6e2b369c9",
|
||||
"vendor-bin\/psalm\/composer.json": "757e0f58bd0d6fe1538d9b55dfd41613ec94dd88d832656344a6ef03749025b3cea15549cc25268d7eadde09446e90dcf6e84160ed3458c5e1dd211a97821cbe"
|
||||
},
|
||||
"signature": "IFgZYiC87Xe73qaCCJPBZxWeqY+Vm9GN0HJN1Xn3DAUkRUhJxv7Labj1+NdTXGPBnM8USg0+FvnVLboG6uYlnZPDhq3CqbeKHNG\/fNKKtZmd0f6s1Q+x0OmrsiJuotn+d8rbmLvog3rjk91QFxP2rliSFXE1HaFan\/YP69zy+OQn\/EfMHwjBVeX2qUFDiF7A98MBirF4O2h2P03U8Qyi1kYxVqAomMlwKUBq8TWzaLaxjaxJqYmG+guxB0OeKtFmg1xgHc7pZ4g4yulO0rUrzMOTqmP6I9cnphH5MWxZXrCs+EqNilw+tYuPWcItGGLwiL\/uNw5v\/MQY\/8sBgPbaf\/7iFO2TDG2vv+OBxmcLXm1MRGT5qye2QZshi20i7vVshS3BZSzwF9QCgqN8gfo1iBdM70FrbVAN4R4WEDoblZbaNJJqcquvFOuMUoVtD6U3Yy6d6fp9krFFxihkRlWxUaDJzEk7AgKd5K0JjY2cu8YXOLyiZZg0aqB5QFNLy72heQ8uw8GkfGhWk5htKE6O0+DxTwDyihTqJ34vsP+LfRKARu53Q3\/\/JtXJwZsq7+D2+ziZBM3HWINSxrR9PfLS3s1UtuGB2EOHQJNBhMNXUgcSk8W7vu\/7M8vF41cE41FdZWBlWAGGCKBeJ9cReghbEkwCJKnB76VzdUDNbAVxJ4g=",
|
||||
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEBjCCAu4CAhJwMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMjQwODA1MDgxMzUzWhcNMzQxMTExMDgxMzUzWjAWMRQwEgYD\r\nVQQDDAtwcmlkZV9mbGFnczCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB\r\nANXCGo6k9P+rMfkXcCizkbxWha9Y5LlMFJxPCE982QUIDqDuuIxUPbHPwIOaLzAr\r\nRZXJY1wEVuNZBmxeavgWvRgYowzRI3UhnwXzQ923hrX39HC84GvoFyXPMw5vgitT\r\nM+veKjDzWnM1GK7ySYebyyR37wZKizMtPpvjqB92MoZmXCn4pOvmmQJx1BMyL8PE\r\nC9cpur++MoYEdUCO27pAY930NdCddDtLi59S6tj2Jkfs9j\/9HO\/3pP7D7hJKmvv2\r\nxy3EG5lMd67KvLzUgG9c8sQZAPpvcGyg0jDcmZqQZQtmbLEQL64HhA6T\/k3FLvh3\r\nldnY2gXViprvGlpS6sqOBQNA5Giqnq6BUhxXWbOxJzKtbdSUPExDeSSK2aDtvXyI\r\nQsA+V7jVlxKg1tcbQ6khhCk2H3Fep8YOLwRE16nVuGP+CSiabOBEKo06qb7K6w+D\r\n\/YsSneDJCED2tuiedFuNjjJPpQK0vmg+hU355ol7Lb5JP1WnAaK7yCyFxcMmD2M5\r\ntFg+acoK3Gyt4a+ptzsXJmAnsppw6mcCgv3hcVFBI9gkQyDgHThZ788gzzWU7soX\r\n06TiZkThYx1Mn1TpRNtbfjMjYQ66FxSRXLB0niJkNJgJ5qhn8nwlfXJDbSC8c4\/H\r\nugIehHOAWI3l5tQNM4pc9wVICBHibbmHkik\/wp0ApGQHAgMBAAEwDQYJKoZIhvcN\r\nAQELBQADggEBAAgLL\/2oYFeL5vJ4eQMjWv3ekIWdMNWvMUOhbAw5eo14ZeZ000Z2\r\neZD7AvMJ1qfA59VHJ5BSVTs\/x\/XTgCtxiWD\/8g+LJp9u8U2rcucgWuiUOA+egyBI\r\n6IffGBc1UqHs6a5dTI2oFgaG3XnM2CLJ3xSoqhv5MMhGJ5fg+wK3o9wk6z10Hfvn\r\nIovtXA9Jz6+cu4dQOkW1TlV1hkyLDGsI5NeZJW+lxHcA9moC++9+8msVPl75CDQO\r\nspB9BZ\/I9SunjT\/wxpTlet5G+G7XW6AO41mcT+Q4bKDqBrnCsyuZZKg39Yp0rODw\r\nbfzhyFTTUFHI\/ydZl67yscmH2fDxU1eZ8Sk=\r\n-----END CERTIFICATE-----"
|
||||
}
|
@ -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);
|
||||
}
|
||||
*/
|
||||
|
BIN
img/pride_flag_variants.png
Normal file
BIN
img/pride_flag_variants.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 109 KiB |
38
js/pride-settings-global.js
Normal file
38
js/pride-settings-global.js
Normal file
@ -0,0 +1,38 @@
|
||||
(function(window) {
|
||||
const folder_selector = document.querySelectorAll('.pride_flags_server_settings .server-settings.folder-flavour select')[0];
|
||||
const button_selector = document.querySelectorAll('.pride_flags_server_settings .server-settings.button-flavour select')[0];
|
||||
const submit_button = document.querySelectorAll('.pride_flags_server_settings .settings-pride-submit');
|
||||
const container = document.querySelector('.pride_flags_server_settings .settings-section');
|
||||
|
||||
function load() {
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings/global'))
|
||||
.then(res => res.json())
|
||||
.then(({folderVariant, buttonVariant}) => {
|
||||
folder_selector.value = folderVariant;
|
||||
button_selector.value = buttonVariant;
|
||||
container.classList.remove('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
function save() {
|
||||
const payload = {
|
||||
folderVariant: folder_selector.value,
|
||||
buttonVariant: button_selector.value,
|
||||
}
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings/global'), {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"requesttoken": OC.requestToken,
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
}
|
||||
submit_button.forEach(node => node.addEventListener('click', e => save()));
|
||||
|
||||
load();
|
||||
})(window);
|
@ -1,36 +1,38 @@
|
||||
(function(window) {
|
||||
const folder_selector = document.querySelectorAll('.pride_flags_user_settings .user-settings.folder-flavour select')[0];
|
||||
const button_selector = document.querySelectorAll('.pride_flags_user_settings .user-settings.button-flavour select')[0];
|
||||
const submit_button = document.querySelectorAll('.pride_flags_user_settings .settings-pride-submit');
|
||||
const container = document.querySelector('.pride_flags_user_settings .settings-section');
|
||||
|
||||
|
||||
const folder_selector = document.querySelectorAll('.pride_flags_user_settings .user-settings.folder-flavour select')[0];
|
||||
const button_selector = document.querySelectorAll('.pride_flags_user_settings .user-settings.button-flavour select')[0];
|
||||
const submit_button = document.querySelectorAll('.pride_flags_user_settings .settings-pride-submit');
|
||||
|
||||
function load() {
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings'))
|
||||
.then(res => res.json())
|
||||
.then(({folderVariant, buttonVariant}) => {
|
||||
folder_selector.value = folderVariant;
|
||||
button_selector.value = buttonVariant;
|
||||
});
|
||||
}
|
||||
|
||||
function save() {
|
||||
const payload = {
|
||||
folderVariant: folder_selector.value,
|
||||
buttonVariant: button_selector.value,
|
||||
function load() {
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings'))
|
||||
.then(res => res.json())
|
||||
.then(({folderVariant, buttonVariant}) => {
|
||||
folder_selector.value = folderVariant;
|
||||
button_selector.value = buttonVariant;
|
||||
container.classList.remove('hidden');
|
||||
});
|
||||
}
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings'), {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"requesttoken": OC.requestToken,
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
}
|
||||
submit_button.forEach(node => node.addEventListener('click', e => save()));
|
||||
|
||||
load();
|
||||
function save() {
|
||||
const payload = {
|
||||
folderVariant: folder_selector.value,
|
||||
buttonVariant: button_selector.value,
|
||||
}
|
||||
fetch(OC.generateUrl('/apps/pride_flags/settings'), {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"requesttoken": OC.requestToken,
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
}
|
||||
submit_button.forEach(node => node.addEventListener('click', e => save()));
|
||||
|
||||
load();
|
||||
})(window);
|
||||
|
21
js/pride.js
21
js/pride.js
@ -7,6 +7,27 @@ const flags = [
|
||||
id: 'trans',
|
||||
colors: ['#55CDFC', '#F7A8B8', '#FFFFFF', '#F7A8B8', '#55CDFC'],
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
id: 'pan',
|
||||
colors: ['#FE218C', '#FFD800', '#21B1FF'],
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
id: 'nonbinary',
|
||||
colors: ['#FCF434', '#FFFFFF', '#9C59D1', '#2C2C2C'],
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
id: 'bi',
|
||||
// colors: ['#C42A6F', '#915392', '#1437A1'],
|
||||
colors: ['#D60270', '#9B4F96', '#0038A8'],
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
id: 'asexual',
|
||||
colors: ['#000000', '#9F9F9F', '#FFFFFF', '#5E1984'],
|
||||
transform: 'rotate(90)'
|
||||
}, {
|
||||
id: 'lesbian',
|
||||
colors: ['#D52D00', '#EF7627', '#FF9A56', '#FFFFFF', '#D162A4', '#B55690', '#A30262'],
|
||||
transform: 'rotate(90)'
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -14,22 +14,35 @@ use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||
use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
#[AuthorizedAdminSetting]
|
||||
public function setGlobal(string $folderVariant, string $buttonVariant): JSONResponse {
|
||||
$this->appSettings->setGlobal($folderVariant, $buttonVariant);
|
||||
return $this->makeJSONResponse(fn () => $this->appSettings->getGlobal());
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
public function getGlobal(): JSONResponse {
|
||||
return $this->makeJSONResponse(fn () => $this->appSettings->getGlobal());
|
||||
}
|
||||
|
||||
protected function makeJSONResponse(Closure $closure): JSONResponse {
|
||||
|
30
lib/Settings/AdminSection.php
Normal file
30
lib/Settings/AdminSection.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\PrideFlags\Settings;
|
||||
|
||||
use OCA\PrideFlags\AppConstants;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Settings\IIConSection;
|
||||
|
||||
class AdminSection implements IIconSection {
|
||||
public function __construct(private IL10N $l10n, private IURLGenerator $urlGenerator) {}
|
||||
|
||||
public function getID(): string {
|
||||
return AppConstants::APP_ID;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return 'Pride Flags';
|
||||
}
|
||||
|
||||
public function getPriority(): int {
|
||||
return 100;
|
||||
}
|
||||
|
||||
public function getIcon(): string {
|
||||
return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg');
|
||||
}
|
||||
}
|
25
lib/Settings/AdminSettings.php
Normal file
25
lib/Settings/AdminSettings.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\PrideFlags\Settings;
|
||||
|
||||
use OCA\PrideFlags\AppConstants;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\Settings\ISettings;
|
||||
use OCP\Util;
|
||||
|
||||
class AdminSettings implements ISettings {
|
||||
public function getForm(): TemplateResponse {
|
||||
Util::addScript(AppConstants::APP_ID, 'pride-settings-global');
|
||||
return new TemplateResponse(AppConstants::APP_ID, 'server-settings', []);
|
||||
}
|
||||
|
||||
public function getSection(): string {
|
||||
return AppConstants::APP_ID;
|
||||
}
|
||||
|
||||
public function getPriority(): int {
|
||||
return 50;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
namespace OCA\PrideFlags\Settings;
|
||||
|
||||
@ -12,23 +12,40 @@ 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)
|
||||
?: ($this->config->getAppValue(AppConstants::APP_ID, $userId, $key) ?: $default);
|
||||
}
|
||||
|
||||
public function setStringSetting(string $key, string $value): void {
|
||||
public function setStringSetting($userId, string $key, string $value): void {
|
||||
$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);
|
||||
}
|
||||
|
||||
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 getGlobal(): array {
|
||||
return [
|
||||
AppSettings::FOLDER_VARIANT => $this->config->getAppValue(AppConstants::APP_ID, AppSettings::FOLDER_VARIANT, 'pride'),
|
||||
AppSettings::BUTTON_VARIANT => $this->config->getAppValue(AppConstants::APP_ID, AppSettings::BUTTON_VARIANT, 'trans'),
|
||||
];
|
||||
}
|
||||
|
||||
public function set($userId, $folder, $button): void {
|
||||
$this->setStringSetting($userId, AppSettings::FOLDER_VARIANT, $folder);
|
||||
$this->setStringSetting($userId, AppSettings::BUTTON_VARIANT, $button);
|
||||
}
|
||||
|
||||
public function setGlobal($folder, $button): void {
|
||||
$this->setAppStringSetting(AppSettings::FOLDER_VARIANT, $folder);
|
||||
$this->setAppStringSetting(AppSettings::BUTTON_VARIANT, $button);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pride_flags",
|
||||
"version": "0.1.0",
|
||||
"version": "1.1.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"engines": {
|
||||
"node": "^20.0.0",
|
||||
|
30
templates/server-settings.php
Normal file
30
templates/server-settings.php
Normal file
@ -0,0 +1,30 @@
|
||||
<div class="pride_flags_server_settings">
|
||||
<div class="settings-section section hidden">
|
||||
<h2 class="settings_section__name">Server-wide preferences</h2>
|
||||
<div class="server-settings folder-flavour" style="margin-left: 40px; display: flex;">
|
||||
<label for="server-settings-folder-flavour-select" style="display: flex; width: 100px;">Folders</label>
|
||||
<select id="server-settings-folder-flavour-select" style="display: flex; width: 200px;">
|
||||
<option value='pride'>Pride</option>
|
||||
<option value='trans'>Trans Pride</option>
|
||||
<option value='pan'>Pansexual Pride</option>
|
||||
<option value='nonbinary'>Non-binary Pride</option>
|
||||
<option value='bi'>Bisexual Pride</option>
|
||||
<option value='asexual'>Asexual Pride</option>
|
||||
<option value='lesbian'>Lesbian Pride</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="server-settings button-flavour" style="margin-left: 40px; display: flex;">
|
||||
<label for="server-settings-button-flavour-select" style="display: flex; width: 100px;">Buttons</label>
|
||||
<select id="server-settings-button-flavour-select" style="display: flex; width: 200px;">
|
||||
<option value='pride'>Pride</option>
|
||||
<option value='trans'>Trans Pride</option>
|
||||
<option value='pan'>Pansexual Pride</option>
|
||||
<option value='nonbinary'>Non-binary Pride</option>
|
||||
<option value='bi'>Bisexual Pride</option>
|
||||
<option value='asexual'>Asexual Pride</option>
|
||||
<option value='lesbian'>Lesbian Pride</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="settings-pride-submit button primary" style="margin-left: 40px; display: flex; width: 80px; text-align: center;">Save</button>
|
||||
</div>
|
||||
</div>
|
@ -2,13 +2,18 @@
|
||||
|
||||
?>
|
||||
<div class="pride_flags_user_settings">
|
||||
<div class="settings-section section">
|
||||
<div class="settings-section section hidden">
|
||||
<h2 class="settings_section__name">Personal preferences</h2>
|
||||
<div class="user-settings folder-flavour" style="margin-left: 40px; display: flex;">
|
||||
<label for="user-settings-folder-flavour-select" style="display: flex; width: 100px;">Folders</label>
|
||||
<select id="user-settings-folder-flavour-select" style="display: flex; width: 200px;">
|
||||
<option value='pride'>Pride</option>
|
||||
<option value='trans'>Trans Pride</option>
|
||||
<option value='pan'>Pansexual Pride</option>
|
||||
<option value='nonbinary'>Non-binary Pride</option>
|
||||
<option value='bi'>Bisexual Pride</option>
|
||||
<option value='asexual'>Asexual Pride</option>
|
||||
<option value='lesbian'>Lesbian Pride</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="user-settings button-flavour" style="margin-left: 40px; display: flex;">
|
||||
@ -16,6 +21,11 @@
|
||||
<select id="user-settings-button-flavour-select" style="display: flex; width: 200px;">
|
||||
<option value='pride'>Pride</option>
|
||||
<option value='trans'>Trans Pride</option>
|
||||
<option value='pan'>Pansexual Pride</option>
|
||||
<option value='nonbinary'>Non-binary Pride</option>
|
||||
<option value='bi'>Bisexual Pride</option>
|
||||
<option value='asexual'>Asexual Pride</option>
|
||||
<option value='lesbian'>Lesbian Pride</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="settings-pride-submit button primary" style="margin-left: 40px; display: flex; width: 80px; text-align: center;">Save</button>
|
||||
|
Loading…
Reference in New Issue
Block a user