diff --git a/README.md b/README.md
index 06888c6..f5e1966 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,9 @@
-Main hosting for my web stuff.
+# The OctoSpacc Hub
+
+* Website:
+
+Main hosting for my web stuff.
Secondary content is hosted in other repos.
+
+* Main repository:
+* Backup repositories:
diff --git a/public/MatrixStickerHelper/index.html b/public/MatrixStickerHelper/index.html
index c6ccaef..32df29d 100644
--- a/public/MatrixStickerHelper/index.html
+++ b/public/MatrixStickerHelper/index.html
@@ -20,8 +20,17 @@
- There is no one around to help... yet.
- Maybe join my Matrix space if you need some: https://matrix.to/#/#Spacc:matrix.org.
+ I created this app for the pursuit of an user-friendly way
+ of managing sticker packs on Matrix,
+ that could also work well for other people,
+ after finding the maunium/stickerpicker import procedure uncomfortable.
+
+ Read more (and follow the development I guess?) at
+ https://octospacc.altervista.org/tag/matrixstickerhelper/.
+
+
How can I add sticker packs to my collection?
+
+ To add new sticker packs to your collection, you can use the dedicated section to
+ input an URL pointing to the JSON data file (in the format used by maunium/stickerpicker)
+ of an already existing collection (index.json) or individual pack (created by other users, or from your backups).
+
+ The ability to create sticker packs by uploading files from your device's storage will soon be available,
+ as well as from the messages sent by other Matrix users.
+
+ Importing stickers from LINE or Telegram is planned for the more distant future.
+
+
Stickerpicker information
+
+ This project is not a substitute of maunium/stickerpicker, and is not affiliated with it, but rather complements it.
+ It sets that up as the sticker picker integration for your Matrix account if you don't have it already,
+ and allows you to manage your sticker collection in a way that is fully compatible with it, but without the manual setup.
+
+
Open-source, licensing, security, collaboration
+
+ This app is open-source, and licensed under the
+ GNU Affero General Public License Version 3.
+ To modify the app, or to check its code for security reasons, you can simply "View Page Source" in your browser.
+
+ This project additionally relies on the following third-party libraries:
+
+
+ Additionally, if there is any issue you want to report, or if you want to send a pull request,
+ feel free to do so at the OctoSpacc Hub repository:
+ https://gitlab.com/octospacc/octospacc.gitlab.io
+ (or contact me via Matrix, see below).
+
+
Other help
+
+ There is no one around to actually help here though... yet.
+ Maybe join my Matrix space, if you need some support:
+ https://matrix.to/#/#Spacc:matrix.org.
@@ -99,7 +151,7 @@ TODO:
The option to create a brand-new pack will soon be available.
`,
mLoginHint: `
- Please login with your [Matrix] account.
+ Please login with your Matrix account.
(Your login details are processed locally and only sent to the homeserver you specified.)
`,
@@ -144,6 +196,21 @@ TODO:
function InitializeState () {
$`#LayoutCollectionActions button[name="back"]`.onclick = () => DisplayAccountSelect();
$`#LayoutCollectionOptions input[name="pickerUrl"]`.value = Defaults.stickerSelectorUrl;
+ $`a[name="version"]`.onclick = () => Spacc.ShowModal({ extraHTML: `
+
+ [2024-01-04]
+
Importing entire sticker collections from URL
+
Fix stickers not loaded from accounts already setup with stock stickerpicker
+
Add help and changelog
+
+
+ [2024-01-03]
+
First release
+
Account management (logging in, reading and writing data)
+
Visualization of current account stickers
+
Importing sticker packs from URL
+
+ `});
}
async function RequestAccountWidgetsData (postData) {
@@ -206,6 +273,14 @@ TODO:
`;
$`#LayoutInfo > button[name="continue"]`.onclick = () => {
$`#LayoutCollectionOptions`.open = false;
+ if (State.widgetsData?.stickerpicker?.content?.url && !packsUrl) {
+ // assuming the user is probably coming from stock maunium/stickerpicker,
+ // and we know that it loads data from a fixed URL when no config param is specified,
+ // we can try loading that when a generic URL is present
+ const packsUrlsPrefix = `${State.widgetsData?.stickerpicker?.content?.url.split('?')[0]}/packs/`;
+ DisplayPacksEditor(`${packsUrlsPrefix}index.json`, packsUrlsPrefix);
+ return;
+ }
DisplayPacksEditor(packsUrl);
};
}
@@ -215,7 +290,7 @@ TODO:
}
}
- async function DisplayPacksEditor (packsUrl) {
+ async function DisplayPacksEditor (packsUrl, packsUrlPrefix) {
ResetLayouts();
$`#LayoutCollectionActions`.hidden = false;
$`#LayoutCollectionOptions`.hidden = false;
@@ -233,11 +308,16 @@ TODO:
Spacc.ShowModal(`${err} ${packsUrl}`);
}
}
+ if (packsUrlPrefix) {
+ for (const packIndex in State.packsData.packs) {
+ State.packsData.packs[packIndex] = `${packsUrlPrefix}${State.packsData.packs[packIndex]}`;
+ }
+ }
const addButton = $().createElement('button');
addButton.name = 'add';
addButton.innerHTML = 'โ๏ธ Create/Import New Pack';
addButton.onclick = (event) => Spacc.ShowModal({ label: Defaults.Strings.mCreatePackHint, extraHTML: `
-
+
`, action: (event, modalButton) => CreateNewPack(event, modalButton) });
$`#LayoutPacksList`.appendChild(addButton);
LoadStickerPacksList();
@@ -256,10 +336,10 @@ TODO:
}
}
- async function CreateNewPack (event, modalButton) {
+ async function CreateNewPack (event, modalButton, packUrl) {
let packData = { stickers: [] };
// if the user specified an URL, try downloading data from there
- const packUrl = modalButton.parentElement.querySelector('input[name="packUrl"]').value;
+ packUrl ||= modalButton.parentElement.querySelector('input[name="packUrl"]').value;
// TODO: warn if an existing pack is imported from that URL and let the user choose if to continue or cancel
//if (packUrl && IsAnyPackImportedFrom(packUrl) && await Spacc.ShowModal({ label: Defaults.Strings.mAlreadyImported, action: () => 'continue', actionCancel: () => 'cancel' }) === 'continue') {
// return;
@@ -268,6 +348,15 @@ TODO:
try {
const request = await fetch(packUrl);
packData = await request.json();
+ // import JSON is an index, so we try to import all its packs
+ if (packData.packs && !packData.stickers) {
+ for (const pack of packData.packs) {
+ const packLower = pack.toLowerCase();
+ const packUrlPrefix = (packLower.startsWith('http://') || packLower.startsWith('http://') ? '' : packUrl.split('/').slice(0, -1).join('/'));
+ await CreateNewPack(null, null, `${packUrlPrefix}/${pack}`);
+ }
+ return;
+ }
$`#LayoutCollectionActions button[name="commit"]`.disabled = false;
} catch(err) {
Spacc.ShowModal(`${err} ${packUrl}`);
@@ -470,7 +559,7 @@ TODO:
`, action: async (event, modalButton) => {
diff --git a/public/index.html b/public/index.html
index b55abfe..33ea29d 100644
--- a/public/index.html
+++ b/public/index.html
@@ -25,13 +25,29 @@