mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-24 18:56:11 +01:00
5d77691d42
Partially for #24457 Major changes: 1. The old `signedUserNameStringPointerKey` is quite hacky, use `ctx.Data[SignedUser]` instead 2. Move duplicate code from `Contexter` to `CommonTemplateContextData` 3. Remove incorrect copying&pasting code `ctx.Data["Err_Password"] = true` in API handlers 4. Use one unique `RenderPanicErrorPage` for panic error page rendering 5. Move `stripSlashesMiddleware` to be the first middleware 6. Install global panic recovery handler, it works for both `install` and `web` 7. Make `500.tmpl` only depend minimal template functions/variables, avoid triggering new panics Screenshot: <details> ![image](https://user-images.githubusercontent.com/2114189/235444895-cecbabb8-e7dc-4360-a31c-b982d11946a7.png) </details>
47 lines
2.4 KiB
Handlebars
47 lines
2.4 KiB
Handlebars
{{/*
|
|
==== DO NOT EDIT ====
|
|
If you are customizing Gitea, please do not change this file.
|
|
If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
|
|
*/}}
|
|
<script>
|
|
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
|
window.config = {
|
|
appUrl: '{{AppUrl}}',
|
|
appSubUrl: '{{AppSubUrl}}',
|
|
assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly
|
|
assetUrlPrefix: '{{AssetUrlPrefix}}',
|
|
runModeIsProd: {{.RunModeIsProd}},
|
|
customEmojis: {{CustomEmojis}},
|
|
useServiceWorker: {{UseServiceWorker}},
|
|
csrfToken: '{{.CsrfToken}}',
|
|
pageData: {{.PageData}},
|
|
notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
|
|
enableTimeTracking: {{EnableTimetracking}},
|
|
{{if or .Participants .Assignees .MentionableTeams}}
|
|
tributeValues: Array.from(new Map([
|
|
{{- range .Participants -}}
|
|
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}],
|
|
{{- end -}}
|
|
{{- range .Assignees -}}
|
|
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}],
|
|
{{- end -}}
|
|
{{- range .MentionableTeams -}}
|
|
['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}', name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}],
|
|
{{- end -}}
|
|
]).values()),
|
|
{{end}}
|
|
mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},
|
|
{{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}}
|
|
i18n: {
|
|
copy_success: '{{.locale.Tr "copy_success"}}',
|
|
copy_error: '{{.locale.Tr "copy_error"}}',
|
|
error_occurred: '{{.locale.Tr "error.occurred"}}',
|
|
network_error: '{{.locale.Tr "error.network_error"}}',
|
|
remove_label_str: '{{.locale.Tr "remove_label_str"}}',
|
|
},
|
|
};
|
|
{{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}}
|
|
window.config.pageData = window.config.pageData || {};
|
|
</script>
|
|
<script src="{{AssetUrlPrefix}}/js/webcomponents.js?v={{AssetVersion}}"></script>
|