summaryrefslogtreecommitdiffstats
path: root/templates/base
diff options
context:
space:
mode:
authorJakob Ackermann <das7pad@outlook.com>2019-10-22 14:11:01 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-10-22 20:11:01 +0800
commit00629fea95970e99ba5ef05954bbad0804805df6 (patch)
tree1590e0f7913c71689727cc17a3bf2786b43028ce /templates/base
parentd0c7a08d751bd068e557efe56683b999d29eb910 (diff)
downloadgitea-00629fea95970e99ba5ef05954bbad0804805df6.tar.gz
gitea-00629fea95970e99ba5ef05954bbad0804805df6.zip
[assets] configurable URL for static resources (#7911)
* static url * add cors support for static resources * [assets] work on the migration to configurable url for assets Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [misc] fix whitespace Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [assets] fix the loading of the manifest.json It is generated dynamically, and as such can not be served by the cdn. Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * Revert "add cors support for static resources" This reverts commit 42f964fd181dbb8b139808b9be623470d4f0e40f Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [docs] add the STATIC_URL_PREFIX option Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [docs] reverse-proxy: nginx: add two setups for STATIC_URL_PREFIX Signed-off-by: Jakob Ackermann <das7pad@outlook.com> * [assets] migrate the url of a new asset to the static url prefix REF: f2a3abc683ad4b2177b7c7c6160a2c0b4316120a Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
Diffstat (limited to 'templates/base')
-rw-r--r--templates/base/footer.tmpl46
-rw-r--r--templates/base/footer_content.tmpl2
-rw-r--r--templates/base/head.tmpl44
-rw-r--r--templates/base/head_navbar.tmpl2
4 files changed, 47 insertions, 47 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index 13718620da..7185b20377 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -12,38 +12,38 @@
{{template "base/footer_content" .}}
- <script src="{{AppSubUrl}}/vendor/plugins/jquery/jquery.min.js?v=3.4.1"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/jquery/jquery.min.js?v=3.4.1"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script>
{{if .RequireSimpleMDE}}
- <script src="{{AppSubUrl}}/vendor/plugins/simplemde/simplemde.min.js"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/codemirror/mode/meta.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js"></script>
<script>
- CodeMirror.modeURL = "{{AppSubUrl}}/vendor/plugins/codemirror/mode/%N/%N.js";
+ CodeMirror.modeURL = "{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/%N/%N.js";
</script>
{{end}}
{{if .RequireGitGraph}}
<!-- graph -->
- <script src="{{AppSubUrl}}/vendor/plugins/gitgraph/gitgraph.js"></script>
- <script src="{{AppSubUrl}}/js/draw.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/gitgraph/gitgraph.js"></script>
+ <script src="{{StaticUrlPrefix}}/js/draw.js"></script>
{{end}}
<!-- Third-party libraries -->
{{if .RequireHighlightJS}}
- <script src="{{AppSubUrl}}/vendor/plugins/highlight/highlight.pack.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/highlight/highlight.pack.js"></script>
{{end}}
{{if .RequireMinicolors}}
- <script src="{{AppSubUrl}}/vendor/plugins/jquery.minicolors/jquery.minicolors.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.min.js"></script>
{{end}}
{{if .RequireDatetimepicker}}
- <script src="{{AppSubUrl}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.js"></script>
{{end}}
{{if .RequireDropzone}}
- <script src="{{AppSubUrl}}/vendor/plugins/dropzone/dropzone.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/dropzone/dropzone.js"></script>
{{end}}
{{if .RequireU2F}}
- <script src="{{AppSubUrl}}/vendor/plugins/u2f/index.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/u2f/index.js"></script>
{{end}}
{{if .EnableCaptcha}}
{{if eq .CaptchaType "recaptcha"}}
@@ -51,7 +51,7 @@
{{end}}
{{end}}
{{if .RequireTribute}}
- <script src="{{AppSubUrl}}/vendor/plugins/tribute/tribute.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/tribute/tribute.min.js"></script>
<script>
var issuesTribute = new Tribute({
values: [
@@ -101,7 +101,7 @@
return ':' + item.original + ':';
},
menuItemTemplate: function (item) {
- return '<img class="emoji" src="{{AppSubUrl}}/vendor/plugins/emojify/images/' + item.original + '.png"/>' + item.original;
+ return '<img class="emoji" src="{{StaticUrlPrefix}}/vendor/plugins/emojify/images/' + item.original + '.png"/>' + item.original;
}
}]
});
@@ -115,16 +115,16 @@
}
</script>
{{end}}
- <script src="{{AppSubUrl}}/vendor/plugins/emojify/emojify.min.js"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/clipboard/clipboard.min.js"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/vue/vue.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/emojify/emojify.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/clipboard/clipboard.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/vue/vue.min.js"></script>
<!-- JavaScript -->
- <script src="{{AppSubUrl}}/vendor/plugins/semantic/semantic.min.js"></script>
- <script src="{{AppSubUrl}}/js/index.js?v={{MD5 AppVer}}"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/semantic/semantic.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/js/index.js?v={{MD5 AppVer}}"></script>
{{if .EnableHeatmap}}
- <script src="{{AppSubUrl}}/vendor/plugins/moment/moment.min.js" charset="utf-8"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/vue-calendar-heatmap/vue-calendar-heatmap.browser.js" charset="utf-8"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/moment/moment.min.js" charset="utf-8"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/vue-calendar-heatmap/vue-calendar-heatmap.browser.js" charset="utf-8"></script>
<script type="text/javascript">
initHeatmap('user-heatmap', '{{.HeatmapUser}}');
</script>
diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl
index 6f680d4cb8..364e58a3d0 100644
--- a/templates/base/footer_content.tmpl
+++ b/templates/base/footer_content.tmpl
@@ -16,7 +16,7 @@
{{end}}
</div>
</div>
- <a href="{{AppSubUrl}}/vendor/librejs.html" data-jslicense="1">JavaScript licenses</a>
+ <a href="{{StaticUrlPrefix}}/vendor/librejs.html" data-jslicense="1">JavaScript licenses</a>
{{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}}
<a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.i18n.Tr "website"}}</a>
{{if (or .ShowFooterVersion .PageIsAdmin)}}<span class="version">{{GoVer}}</span>{{end}}
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 7cdfdd34be..ae2b6b954d 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -70,35 +70,35 @@
THE SOFTWARE.
---
Licensing information for additional javascript libraries can be found at:
- {{AppSubUrl}}/vendor/librejs.html
+ {{StaticUrlPrefix}}/vendor/librejs.html
@licend The above is the entire license notice
for the JavaScript code in this page.
*/`}}
</script>
- <link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" />
- <link rel="mask-icon" href="{{AppSubUrl}}/img/gitea-safari.svg" color="#609926">
- <link rel="preload" href="{{AppSubUrl}}/vendor/assets/font-awesome/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'">
- <noscript><link rel="stylesheet" href="{{AppSubUrl}}/vendor/assets/font-awesome/css/font-awesome.min.css"></noscript>
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/assets/octicons/octicons.min.css">
+ <link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png" />
+ <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'">
+ <noscript><link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css"></noscript>
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.min.css">
{{if .RequireSimpleMDE}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/simplemde/simplemde.min.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.css">
{{end}}
{{if .RequireGitGraph}}
<!-- graph -->
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/gitgraph/gitgraph.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/gitgraph/gitgraph.css">
{{end}}
{{if .RequireTribute}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/tribute/tribute.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/tribute/tribute.css">
{{end}}
<!-- Stylesheet -->
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/semantic/semantic.min.css">
- <link rel="stylesheet" href="{{AppSubUrl}}/css/index.css?v={{MD5 AppVer}}">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/semantic/semantic.min.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
<noscript>
<style>
.dropdown:hover > .menu { display: block; }
@@ -107,25 +107,25 @@
</noscript>
{{if .RequireHighlightJS}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/highlight/github.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/highlight/github.css">
{{end}}
{{if .RequireMinicolors}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css">
{{end}}
{{if .RequireDatetimepicker}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/jquery.datetimepicker/jquery.datetimepicker.css">
{{end}}
{{if .RequireDropzone}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/dropzone/dropzone.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/dropzone/dropzone.css">
{{end}}
{{if .EnableHeatmap}}
- <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/vue-calendar-heatmap/vue-calendar-heatmap.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/vue-calendar-heatmap/vue-calendar-heatmap.css">
{{end}}
<style class="list-search-style"></style>
- <script src="{{AppSubUrl}}/vendor/plugins/promise-polyfill/polyfill.min.js"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/loadCSS.min.js"></script>
- <script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/cssrelpreload.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/promise-polyfill/polyfill.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/cssrelpreload/loadCSS.min.js"></script>
+ <script src="{{StaticUrlPrefix}}/vendor/plugins/cssrelpreload/cssrelpreload.min.js"></script>
{{if .PageIsUserProfile}}
<meta property="og:title" content="{{.Owner.Name}}" />
<meta property="og:type" content="profile" />
@@ -144,16 +144,16 @@
{{else}}
<meta property="og:title" content="{{AppName}}">
<meta property="og:type" content="website" />
- <meta property="og:image" content="{{AppUrl}}img/gitea-lg.png" />
+ <meta property="og:image" content="{{StaticUrlPrefix}}img/gitea-lg.png" />
<meta property="og:url" content="{{AppUrl}}" />
<meta property="og:description" content="{{MetaDescription}}">
{{end}}
{{if .IsSigned }}
{{ if ne .SignedUser.Theme "gitea" }}
- <link rel="stylesheet" href="{{AppSubUrl}}/css/theme-{{.SignedUser.Theme}}.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css">
{{end}}
{{else if ne DefaultTheme "gitea"}}
- <link rel="stylesheet" href="{{AppSubUrl}}/css/theme-{{DefaultTheme}}.css">
+ <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{DefaultTheme}}.css">
{{end}}
{{template "custom/header" .}}
</head>
diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl
index 390a1fe804..fdba57d5bf 100644
--- a/templates/base/head_navbar.tmpl
+++ b/templates/base/head_navbar.tmpl
@@ -1,7 +1,7 @@
<div class="ui container" id="navbar">
<div class="item brand" style="justify-content: space-between;">
<a href="{{AppSubUrl}}/">
- <img class="ui mini image" src="{{AppSubUrl}}/img/gitea-sm.png">
+ <img class="ui mini image" src="{{StaticUrlPrefix}}/img/gitea-sm.png">
</a>
<div class="ui basic icon button mobile-only" id="navbar-expand-toggle">
<i class="sidebar icon"></i>