mirror of
https://github.com/go-gitea/gitea
synced 2024-11-06 02:04:26 +00:00
Previously, we had only set __webpack_public_path__ to a path which caused webpack chunks to be loaded from the current origin which is incorrect when STATIC_URL_PREFIX points to another origin. This should fix the issue curretnly seen on gitea.com. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
ed646078e1
commit
c0c3a533a0
@ -84,7 +84,11 @@
|
|||||||
for the JavaScript code in this page.
|
for the JavaScript code in this page.
|
||||||
*/`}}
|
*/`}}
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
window.config = {
|
||||||
|
StaticUrlPrefix: '{{StaticUrlPrefix}}'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png" />
|
<link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png" />
|
||||||
<link rel="mask-icon" href="{{StaticUrlPrefix}}/img/gitea-safari.svg" color="#609926">
|
<link rel="mask-icon" href="{{StaticUrlPrefix}}/img/gitea-safari.svg" color="#609926">
|
||||||
<link rel="preload" href="{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'">
|
<link rel="preload" href="{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'">
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
/* This sets up webpack's chunk loading to load resources from the same
|
// This sets up the URL prefix used in webpack's chunk loading.
|
||||||
directory where it loaded index.js from. This file must be imported
|
// This file must be imported before any lazy-loading is being attempted.
|
||||||
before any lazy-loading is being attempted. */
|
const { StaticUrlPrefix } = window.config;
|
||||||
|
|
||||||
if (document.currentScript && document.currentScript.src) {
|
if (StaticUrlPrefix) {
|
||||||
|
__webpack_public_path__ = StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`;
|
||||||
|
} else if (document.currentScript && document.currentScript.src) {
|
||||||
const url = new URL(document.currentScript.src);
|
const url = new URL(document.currentScript.src);
|
||||||
__webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`;
|
__webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user