mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) move some untagged assets served on plugin port
Summary: Some untagged assets on the plugin port could be a problem if that port is merged with the regular Grist app port, so we nest them within a non-conflicting path (/plugins/assets). Test Plan: see if a test fails anywhere Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D4116
This commit is contained in:
@@ -596,14 +596,19 @@ export class FlexServer implements GristServer {
|
||||
|
||||
// Plugin operation relies currently on grist-plugin-api.js being available,
|
||||
// and with Grist's static assets to be also available on the untrusted
|
||||
// host. The assets should be available without version tags.
|
||||
// host. The assets should be available without version tags, but not
|
||||
// at the root level - we nest them in /plugins/assets.
|
||||
public async addAssetsForPlugins() {
|
||||
if (this._check('pluginUntaggedAssets', 'dir')) { return; }
|
||||
this.app.use(/^\/(grist-plugin-api.js)$/, expressWrap(async (req, res) =>
|
||||
res.sendFile(req.params[0], {root: getAppPathTo(this.appRoot, 'static')})));
|
||||
// Plugins get access to static resources without a tag
|
||||
this.app.use(limitToPlugins(this, express.static(getAppPathTo(this.appRoot, 'static'))));
|
||||
this.app.use(limitToPlugins(this, express.static(getAppPathTo(this.appRoot, 'bower_components'))));
|
||||
this.app.use(
|
||||
'/plugins/assets',
|
||||
limitToPlugins(this, express.static(getAppPathTo(this.appRoot, 'static'))));
|
||||
this.app.use(
|
||||
'/plugins/assets',
|
||||
limitToPlugins(this, express.static(getAppPathTo(this.appRoot, 'bower_components'))));
|
||||
// Serve custom-widget.html message for anyone.
|
||||
this.app.use(/^\/(custom-widget.html)$/, expressWrap(async (req, res) =>
|
||||
res.sendFile(req.params[0], {root: getAppPathTo(this.appRoot, 'static')})));
|
||||
|
||||
Reference in New Issue
Block a user