Hi there,
I’m starting the development of a « categories management plugin ». This is my first Peertube plugin and since this is a contract, I’m planning to start with a naïve implementation to get something up and running quickly.
Naïve implementation
UI will only consists in an upload button. The uploaded file will be a json
file with the following format :
{
added: [
{ key: 42, label: "Truth" }
],
deleted: [
1, // Music
]
}
The idea is to be as close as possible to the video constants customization API :
PeerTube/register-helpers.ts at v3.2.1 · Chocobozzz/PeerTube · GitHub
Better implementation
For the next implementation I’m planning to have a better UI with a table representation of the categories and their customization, something which would abstract the implementation details of the video constants customization system.
A PeerTube plugin exposing the whole video constants customization system with a nice UI would probably be useful. But this is out of my current scope.
From what I gathered the plugin system doesn’t allow to --strictly speaking – delete existing constants but rather hide them.
One issue I saw with the current system is, it doesn’t allow to delete an added constant (I’m not sure if it’s the expected behavior or not).
If we call deleteConstant
it won’t look for (and delete) a constant which was previouslyadded
with addConstant
.
See PeerTube/register-helpers.ts at v3.2.1 · Chocobozzz/PeerTube · GitHub
If it’s not intentional let me know and I might post an issue about this and submit a PR.
Otherwise I’ll probably store the added
and deleted
categories in the plugin settings and reset the video constants customization via reinitVideoConstants
each time the settings are changing.
What do you think would be the best course of action @Chocobozzz ?
One last question… which Controller/Page/UI should I pick as a reference implementation for this category management page?