-
-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add core extensions: UserCSS, UserJS #6267
base: edge
Are you sure you want to change the base?
Conversation
The name is used for the directory where the configuration is stored and should not contain spaces. Since the name was changed, I reset the version number and changed to semantic versioning.
Changed the location of the configuration file to the user data directory, because it is not `static`. That way, the user's configurations are gathered in the user directory, which makes it easier to backup them.
Remove procedures to install the extension because it is no longer necessary.
Remove permission error indication because the storage location is now in the user data directory managed by the application.
Thanks! We will first issue FreshRSS 1.24 relatively soon and then address bigger changes such as this one in the edge version towards the next release |
I have done some refactoring. Please double-check. |
- 1.0.0 change rules location to user data folder; promoted to core extension | ||
- 0.0.1 initial version | ||
|
||
## Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could consider adding something in our documentation for core extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's move the description to that document.
Please let me know a few things.
- Can I add it to here in the "Extensions" section?
- Is it acceptable to add only English, because I cannot use French?
- Can I reduce some of the configuration examples, as I don't think we need many of them?
- Can I remove the README for this extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated docs.
|
||
/** Return the user-specific, extension-specific, file content, or null if it does not exist */ | ||
protected final function getFile(string $filename): ?string { | ||
$content = @file_get_contents($this->getExtensionUserPath() . '/' . $filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, we could try to see whether we could reduce the permissions for the extensions, so they can only call inherited functions
Version 0.0.1 will not be merged, so only version 1.0.0 will remain.
Thanks, nice refactoring. I think it is a good idea to make some functions |
All the extensions of https://github.com/FreshRSS/Extensions are tested automatically, at least |
I have made a new command to automatically test all known third-party FreshRSS extensions FreshRSS/Extensions#228 |
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "UserCSS", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we give a better name here?
Something like "Tweak UI with CSS" or "UI Tweaker"? Please with spaces instead of CamelCases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not really mind. For me something with CSS in the name would be most obvious, such as "Custom CSS"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like CSS Tweaks and JS Tweaks, but User CSS / UserCSS and User JS / UserJS are decent enough names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind if it is not named "UserCSS", but I did not put a space because this name will be used for the configuration file directory name.
I don't want to include spaces in any file paths.
Although the specifications will be changed, could we use $this->getEntrypoint
instead of $this->getName()
for the configuration file directory name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hkcomori That is a reasonable suggestion, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some AI suggestions:
- CSS Customizer
- CSS Personalizer
- Flexible CSS Tuner
- CSS Overwriter
- CSS Remixer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those suggestions are worse to much worse imho. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I changed the directory name to entrypoint and added a space to the name.
lib/Minz/Extension.php
Outdated
return USERS_PATH . "/{$username}/extensions/{$this->getName()}"; | ||
return USERS_PATH . "/{$username}/extensions/{$this->getEntrypoint()}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this cause a new entry in the update.php that changes existing paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could, if anyone is motivated in doing so. Might be a bit tricky to do safely, though. Another option could be to have a migration code in
FreshRSS/lib/Minz/Extension.php
Line 83 in 7aaed60
abstract public function init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we expect version jumps, I think it is better method suggested by @Alkarex.
But we can't have a common migration code in init()
, because it will be overwritten by each extension.
So how about adding a new method that is called just before init()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, the extensions should call the parent method parent::init()
when overriding. We could fix those we know like I did in FreshRSS/Extensions#228
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then I will implement the migration code in init()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was also necessary to add migration code in handleConfigureAction()
to support the use case of opening the configuration view before enabling the extension.
Closes FreshRSS/Extensions#227
Changes proposed in this pull request:
How to test the feature manually:
data/users/extensions/<extension-name>
.<head>
.Pull request checklist:
Additional information can be found in the documentation.