Rename StaticUrlPrefix to AssetUrlPrefix (#15779)

Use a new name for this template/frontend variable to make it distinct
from the server variable StaticURLPrefix.
tokarchuk/v1.17
silverwind 4 years ago committed by GitHub
parent e278614753
commit 24ad131221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/templates/helper.go
  2. 18
      templates/admin/hook_new.tmpl
  3. 12
      templates/base/footer.tmpl
  4. 2
      templates/base/footer_content.tmpl
  5. 16
      templates/base/head.tmpl
  6. 2
      templates/base/head_navbar.tmpl
  7. 2
      templates/home.tmpl
  8. 2
      templates/install.tmpl
  9. 18
      templates/org/settings/hook_new.tmpl
  10. 2
      templates/post-install.tmpl
  11. 4
      templates/repo/migrate/migrating.tmpl
  12. 18
      templates/repo/settings/webhook/base_list.tmpl
  13. 18
      templates/repo/settings/webhook/new.tmpl
  14. 2
      templates/repo/view_file.tmpl
  15. 2
      templates/status/404.tmpl
  16. 2
      templates/status/500.tmpl
  17. 4
      templates/swagger/ui.tmpl
  18. 4
      web_src/js/features/emoji.js
  19. 2
      web_src/js/features/serviceworker.js
  20. 4
      web_src/js/index.js
  21. 6
      web_src/js/publicpath.js

@ -60,7 +60,7 @@ func NewFuncMap() []template.FuncMap {
"AppSubUrl": func() string {
return setting.AppSubURL
},
"StaticUrlPrefix": func() string {
"AssetUrlPrefix": func() string {
return setting.StaticURLPrefix + "/assets"
},
"AppUrl": func() string {

@ -15,23 +15,23 @@
{{end}}
<div class="ui right">
{{if eq .HookType "gitea"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/gitea.svg">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/gitea.svg">
{{else if eq .HookType "gogs"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/gogs.ico">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/gogs.ico">
{{else if eq .HookType "slack"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/slack.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/slack.png">
{{else if eq .HookType "discord"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/discord.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/discord.png">
{{else if eq .HookType "dingtalk"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/dingtalk.ico">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/dingtalk.ico">
{{else if eq .HookType "telegram"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/telegram.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/telegram.png">
{{else if eq .HookType "msteams"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/msteams.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/msteams.png">
{{else if eq .HookType "feishu"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/feishu.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/feishu.png">
{{else if eq .HookType "matrix"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/matrix.svg">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/matrix.svg">
{{end}}
</div>
</h4>

@ -12,17 +12,17 @@
{{template "base/footer_content" .}}
{{if .RequireSimpleMDE}}
<script src="{{StaticUrlPrefix}}/js/easymde.js?v={{MD5 AppVer}}"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js"></script>
<script src="{{AssetUrlPrefix}}/js/easymde.js?v={{MD5 AppVer}}"></script>
<script src="{{AssetUrlPrefix}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script>
<script src="{{AssetUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js"></script>
<script>
CodeMirror.modeURL = '{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/%N/%N.js';
CodeMirror.modeURL = '{{AssetUrlPrefix}}/vendor/plugins/codemirror/mode/%N/%N.js';
</script>
{{end}}
<!-- Third-party libraries -->
{{if .RequireU2F}}
<script src="{{StaticUrlPrefix}}/vendor/plugins/u2f/index.js"></script>
<script src="{{AssetUrlPrefix}}/vendor/plugins/u2f/index.js"></script>
{{end}}
{{if .EnableCaptcha}}
{{if eq .CaptchaType "recaptcha"}}
@ -32,7 +32,7 @@
<script src='https://hcaptcha.com/1/api.js' async></script>
{{end}}
{{end}}
<script src="{{StaticUrlPrefix}}/js/index.js?v={{MD5 AppVer}}"></script>
<script src="{{AssetUrlPrefix}}/js/index.js?v={{MD5 AppVer}}"></script>
{{template "custom/footer" .}}
</body>
</html>

@ -16,7 +16,7 @@
{{end}}
</div>
</div>
<a href="{{StaticUrlPrefix}}/js/licenses.txt">{{.i18n.Tr "licenses"}}</a>
<a href="{{AssetUrlPrefix}}/js/licenses.txt">{{.i18n.Tr "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>
{{template "custom/extra_links_footer" .}}

@ -29,7 +29,7 @@
window.config = {
AppVer: '{{AppVer}}',
AppSubUrl: '{{AppSubUrl}}',
StaticUrlPrefix: '{{StaticUrlPrefix}}',
AssetUrlPrefix: '{{AssetUrlPrefix}}',
UseServiceWorker: {{UseServiceWorker}},
csrf: '{{.CsrfToken}}',
HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
@ -61,12 +61,12 @@
{{end}}
};
</script>
<link rel="icon" href="{{StaticUrlPrefix}}/img/logo.svg" type="image/svg+xml">
<link rel="alternate icon" href="{{StaticUrlPrefix}}/img/favicon.png" type="image/png">
<link rel="icon" href="{{AssetUrlPrefix}}/img/logo.svg" type="image/svg+xml">
<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
{{if .RequireSimpleMDE}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/easymde.css?v={{MD5 AppVer}}">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/easymde.css?v={{MD5 AppVer}}">
{{end}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
<noscript>
<style>
.dropdown:hover > .menu { display: block; }
@ -105,17 +105,17 @@
{{else}}
<meta property="og:title" content="{{AppName}}">
<meta property="og:type" content="website" />
<meta property="og:image" content="{{StaticUrlPrefix}}/img/logo.png" />
<meta property="og:image" content="{{AssetUrlPrefix}}/img/logo.png" />
<meta property="og:url" content="{{AppUrl}}" />
<meta property="og:description" content="{{MetaDescription}}">
{{end}}
<meta property="og:site_name" content="{{AppName}}" />
{{if .IsSigned }}
{{ if ne .SignedUser.Theme "gitea" }}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css?v={{MD5 AppVer}}">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css?v={{MD5 AppVer}}">
{{end}}
{{else if ne DefaultTheme "gitea"}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{DefaultTheme}}.css?v={{MD5 AppVer}}">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{DefaultTheme}}.css?v={{MD5 AppVer}}">
{{end}}
{{template "custom/header" .}}
</head>

@ -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" with="30" height="30" src="{{StaticUrlPrefix}}/img/logo.svg">
<img class="ui mini image" with="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg">
</a>
<div class="ui basic icon button mobile-only" id="navbar-expand-toggle">
<i class="sidebar icon"></i>

@ -3,7 +3,7 @@
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div>
<img class="logo" width="220" height="220" src="{{StaticUrlPrefix}}/img/logo.svg"/>
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg"/>
</div>
<div class="hero">
<h1 class="ui icon header title">

@ -321,5 +321,5 @@
</div>
</div>
</div>
<img style="display: none" src="{{StaticUrlPrefix}}/img/loading.png"/>
<img style="display: none" src="{{AssetUrlPrefix}}/img/loading.png"/>
{{template "base/footer" .}}

@ -10,23 +10,23 @@
{{if .PageIsSettingsHooksNew}}{{.i18n.Tr "repo.settings.add_webhook"}}{{else}}{{.i18n.Tr "repo.settings.update_webhook"}}{{end}}
<div class="ui right">
{{if eq .HookType "gitea"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/gitea.svg">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/gitea.svg">
{{else if eq .HookType "gogs"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/gogs.ico">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/gogs.ico">
{{else if eq .HookType "slack"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/slack.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/slack.png">
{{else if eq .HookType "discord"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/discord.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/discord.png">
{{else if eq .HookType "dingtalk"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/dingtalk.ico">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/dingtalk.ico">
{{else if eq .HookType "telegram"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/telegram.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/telegram.png">
{{else if eq .HookType "msteams"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/msteams.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/msteams.png">
{{else if eq .HookType "feishu"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/feishu.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/feishu.png">
{{else if eq .HookType "matrix"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/matrix.svg">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/matrix.svg">
{{end}}
</div>
</h4>

@ -7,7 +7,7 @@
<div class="ui stackable middle very relaxed page grid">
<div id="repo_migrating" class="sixteen wide center aligned centered column">
<div>
<img src="{{StaticUrlPrefix}}/img/loading.png"/>
<img src="{{AssetUrlPrefix}}/img/loading.png"/>
</div>
</div>
</div>

@ -9,12 +9,12 @@
<div class="ui stackable middle very relaxed page grid">
<div id="repo_migrating" class="sixteen wide center aligned centered column" task="{{.MigrateTask.ID}}">
<div>
<img src="{{StaticUrlPrefix}}/img/loading.png"/>
<img src="{{AssetUrlPrefix}}/img/loading.png"/>
</div>
</div>
<div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column" style="display: none;">
<div>
<img src="{{StaticUrlPrefix}}/img/failed.png"/>
<img src="{{AssetUrlPrefix}}/img/failed.png"/>
</div>
</div>
</div>

@ -5,31 +5,31 @@
<div class="ui blue tiny button">{{.i18n.Tr "repo.settings.add_webhook"}}</div>
<div class="menu">
<a class="item" href="{{.BaseLinkNew}}/gitea/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/gitea.svg">Gitea
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/gitea.svg">Gitea
</a>
<a class="item" href="{{.BaseLinkNew}}/gogs/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/gogs.ico">Gogs
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/gogs.ico">Gogs
</a>
<a class="item" href="{{.BaseLinkNew}}/slack/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/slack.png">Slack
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/slack.png">Slack
</a>
<a class="item" href="{{.BaseLinkNew}}/discord/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/discord.png">Discord
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/discord.png">Discord
</a>
<a class="item" href="{{.BaseLinkNew}}/dingtalk/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/dingtalk.ico">Dingtalk
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/dingtalk.ico">Dingtalk
</a>
<a class="item" href="{{.BaseLinkNew}}/telegram/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/telegram.png">Telegram
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/telegram.png">Telegram
</a>
<a class="item" href="{{.BaseLinkNew}}/msteams/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/msteams.png">Microsoft Teams
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/msteams.png">Microsoft Teams
</a>
<a class="item" href="{{.BaseLinkNew}}/feishu/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/feishu.png">Feishu
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/feishu.png">Feishu
</a>
<a class="item" href="{{.BaseLinkNew}}/matrix/new">
<img width="20" height="20" src="{{StaticUrlPrefix}}/img/matrix.svg">Matrix
<img width="20" height="20" src="{{AssetUrlPrefix}}/img/matrix.svg">Matrix
</a>
</div>
</div>

@ -8,23 +8,23 @@
{{if .PageIsSettingsHooksNew}}{{.i18n.Tr "repo.settings.add_webhook"}}{{else}}{{.i18n.Tr "repo.settings.update_webhook"}}{{end}}
<div class="ui right">
{{if eq .HookType "gitea"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/gitea.svg">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/gitea.svg">
{{else if eq .HookType "gogs"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/gogs.ico">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/gogs.ico">
{{else if eq .HookType "slack"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/slack.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/slack.png">
{{else if eq .HookType "discord"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/discord.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/discord.png">
{{else if eq .HookType "dingtalk"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/dingtalk.ico">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/dingtalk.ico">
{{else if eq .HookType "telegram"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/telegram.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/telegram.png">
{{else if eq .HookType "msteams"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/msteams.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/msteams.png">
{{else if eq .HookType "feishu"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/feishu.png">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/feishu.png">
{{else if eq .HookType "matrix"}}
<img width="26" height="26" src="{{StaticUrlPrefix}}/img/matrix.svg">
<img width="26" height="26" src="{{AssetUrlPrefix}}/img/matrix.svg">
{{end}}
</div>
</h4>

@ -82,7 +82,7 @@
<strong>{{.i18n.Tr "repo.audio_not_supported_in_browser"}}</strong>
</audio>
{{else if .IsPDFFile}}
<iframe width="100%" height="600px" src="{{StaticUrlPrefix}}/vendor/plugins/pdfjs/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
<iframe width="100%" height="600px" src="{{AssetUrlPrefix}}/vendor/plugins/pdfjs/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
{{else}}
<a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
{{end}}

@ -2,7 +2,7 @@
<div class="page-content ui container center full-screen-width {{if .IsRepo}}repository{{end}}">
{{if .IsRepo}}{{template "repo/header" .}}{{end}}
<div class="ui container center">
<p style="margin-top: 100px"><img class="ui centered image" src="{{StaticUrlPrefix}}/img/404.png" alt="404"/></p>
<p style="margin-top: 100px"><img class="ui centered image" src="{{AssetUrlPrefix}}/img/404.png" alt="404"/></p>
<div class="ui divider"></div>
<br>
<p>{{.i18n.Tr "error404" | Safe}}

@ -1,6 +1,6 @@
{{template "base/head" .}}
<div class="page-content ui container full-screen-width center">
<p style="margin-top: 100px"><img class="ui centered image" src="{{StaticUrlPrefix}}/img/500.png" alt="500"/></p>
<p style="margin-top: 100px"><img class="ui centered image" src="{{AssetUrlPrefix}}/img/500.png" alt="500"/></p>
<div class="ui divider"></div>
<br>
{{if .ErrorMsg}}<p>{{.i18n.Tr "error.occurred"}}:</p>

@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8">
<title>Gitea API</title>
<link href="{{StaticUrlPrefix}}/css/swagger.css?v={{MD5 AppVer}}" rel="stylesheet">
<link href="{{AssetUrlPrefix}}/css/swagger.css?v={{MD5 AppVer}}" rel="stylesheet">
</head>
<body>
<a class="swagger-back-link" href="{{AppUrl}}">{{svg "octicon-reply"}}{{.i18n.Tr "return_to_gitea"}}</a>
<div id="swagger-ui" data-source="{{AppUrl}}swagger.{{.APIJSONVersion}}.json"></div>
<script src="{{StaticUrlPrefix}}/js/swagger.js?v={{MD5 AppVer}}"></script>
<script src="{{AssetUrlPrefix}}/js/swagger.js?v={{MD5 AppVer}}"></script>
</body>
</html>

@ -1,6 +1,6 @@
import emojis from '../../../assets/emoji.json';
const {StaticUrlPrefix} = window.config;
const {AssetUrlPrefix} = window.config;
const tempMap = {gitea: ':gitea:'};
for (const {emoji, aliases} of emojis) {
@ -24,7 +24,7 @@ for (const key of emojiKeys) {
export function emojiHTML(name) {
let inner;
if (name === 'gitea') {
inner = `<img alt=":${name}:" src="${StaticUrlPrefix}/img/emoji/gitea.png">`;
inner = `<img alt=":${name}:" src="${AssetUrlPrefix}/img/emoji/gitea.png">`;
} else {
inner = emojiString(name);
}

@ -31,7 +31,7 @@ export default async function initServiceWorker() {
if (UseServiceWorker) {
try {
// normally we'd serve the service worker as a static asset from StaticUrlPrefix but
// normally we'd serve the service worker as a static asset from AssetUrlPrefix but
// the spec strictly requires it to be same-origin so it has to be AppSubUrl to work
await Promise.all([
checkCacheValidity(),

@ -25,7 +25,7 @@ import {renderMarkupContent} from './markup/content.js';
import {stripTags, mqBinarySearch} from './utils.js';
import {svg, svgs} from './svg.js';
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
const {AppSubUrl, AssetUrlPrefix, csrf} = window.config;
let previewFileModes;
const commentMDEditors = {};
@ -3138,7 +3138,7 @@ function initVueComponents() {
finalPage: 1,
searchQuery,
isLoading: false,
staticPrefix: StaticUrlPrefix,
staticPrefix: AssetUrlPrefix,
counts: {},
repoTypes: {
all: {

@ -1,9 +1,9 @@
// This sets up the URL prefix used in webpack's chunk loading.
// This file must be imported before any lazy-loading is being attempted.
const {StaticUrlPrefix} = window.config;
const {AssetUrlPrefix} = window.config;
if (StaticUrlPrefix) {
__webpack_public_path__ = StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`;
if (AssetUrlPrefix) {
__webpack_public_path__ = AssetUrlPrefix.endsWith('/') ? AssetUrlPrefix : `${AssetUrlPrefix}/`;
} else {
const url = new URL(document.currentScript.src);
__webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/');

Loading…
Cancel
Save