| Summary: | Add plugins/js directory | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
| Component: | Plugin architecture | Assignee: | Marcel de Rooy <m.de.rooy> |
| Status: | RESOLVED LATER | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | dcook |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39435 | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Attachments: | Bug 39466: Add plugins/js folder, add access in Apache | ||
|
Description
Marcel de Rooy
2025-03-27 09:44:35 UTC
Created attachment 179758 [details] [review] Bug 39466: Add plugins/js folder, add access in Apache Test plan: Run the adjusted koha-create-dirs (or copy it to sbin and run koha-create) and verify folder creation. Remove the folders (manually or use koha-remove in case you used koha-create). Create the js folder in your own /var/lib/koha/YOUR_INSTANCE/plugins folder. (Optionally, chmod 550 it.) Copy the change in the apache-shared file into your /etc/koha counterpart. Restart Apache. Touch /var/lib/koha/YOUR_INSTANCE/plugins/js/test.txt. Verify that you can reach it with URL /plugins/js/test.txt. I'm not sure that I understand this one. Could you elaborate on it a bit more? (In reply to David Cook from comment #2) > I'm not sure that I understand this one. Could you elaborate on it a bit > more? On the other bug a plugin sends back html which could include a js link to a script in this plugin folder. This js is not part of Koha, but part of the plugin. (In reply to Marcel de Rooy from comment #3) > (In reply to David Cook from comment #2) > > I'm not sure that I understand this one. Could you elaborate on it a bit > > more? > > On the other bug a plugin sends back html which could include a js link to a > script in this plugin folder. This js is not part of Koha, but part of the > plugin. But how would the Javascript get into this folder? It seems like it would have to be manually set up? (In reply to David Cook from comment #4) > (In reply to Marcel de Rooy from comment #3) > > (In reply to David Cook from comment #2) > > > I'm not sure that I understand this one. Could you elaborate on it a bit > > > more? > > > > On the other bug a plugin sends back html which could include a js link to a > > script in this plugin folder. This js is not part of Koha, but part of the > > plugin. > > But how would the Javascript get into this folder? It seems like it would > have to be manually set up? Yes we need some adjustment in the plugin install. (In reply to Marcel de Rooy from comment #5) > Yes we need some adjustment in the plugin install. I don't know that it will work, since there's lots of different ways to deploy the plugins. For instance, I actually separate my plugins into /var/lib/koha/<instance>/<plugin_name> and add them as separate pluginsdir entries, as I find this makes it much easier to manage them. Some people point to places like /opt/all_my_koha_plugins and stuff like that. For the Javascript, you could use the "static_routes" plugin hook. (In reply to David Cook from comment #6) > (In reply to Marcel de Rooy from comment #5) > > Yes we need some adjustment in the plugin install. > > I don't know that it will work, since there's lots of different ways to > deploy the plugins. > > For instance, I actually separate my plugins into > /var/lib/koha/<instance>/<plugin_name> and add them as separate pluginsdir > entries, as I find this makes it much easier to manage them. Some people > point to places like /opt/all_my_koha_plugins and stuff like that. > > For the Javascript, you could use the "static_routes" plugin hook. Ok, didnt think about the static_routes here. But it might still be easier and faster to serve directly from this plugins/js folder. When installing copy js files to that folder, and when uninstalling remove the same files again there. For common js libraries, we could define a dedicated plugin that only serves to install those common js files? Or even call it plugins/static and copy whatever you have in [your_plugin]/static to the common folder? (In reply to Marcel de Rooy from comment #7) > Ok, didnt think about the static_routes here. But it might still be easier > and faster to serve directly from this plugins/js folder. That's true. > When installing copy js files to that folder, and when uninstalling remove > the same files again there. Maybe but that would be a big shift in how plugins work I think. It would be interesting to see what heavy plugin users thing of that. Actually, I like the idea of changing how plugin deployments work. Honestly, I think I might prefer a system where plugin code got copied/moved at install/uninstall time. (Not just the JS but all of it.) Food for tought... > For common js libraries, we could define a > dedicated plugin that only serves to install those common js files? > > Or even call it plugins/static and copy whatever you have in > [your_plugin]/static to the common folder? I'm not sure that I understand what you're saying here. If we did standardize the location of plugins, and install them under a plugin name (after all we already define namespaces in up-to-date plugins), we could use "AliasMatch" to serve static files out of /var/lib/<koha>/pluginsv2/<koha_plugin_namespace>/static or /var/lib/<koha>/pluginsv2/<koha_plugin_namespace>/public Closing this one for now. |