mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-03-12 00:12:37 +01:00
- In the case that the `ROOT_URL` does not match the site a person is visiting Forgejo gives zero guarantees that any of the functionality will still work. - Make the error i18n, use `local_next`. - Reflect in the error that the any part of the application can break, don't be specific - it is plain wrong and should not be used. - Always check for this case on the login page. This was previously only the case if OAuth2 was enabled, but this code was checking for elements that are always present on the login page regardless if the OAuth2 was enabled or not. Technically nothing changed, but reading the code it is now more clear when this check is being run. - Add E2E testing. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7103 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
51 lines
2.9 KiB
Go HTML Template
51 lines
2.9 KiB
Go HTML Template
{{/*
|
|
==== 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>
|
|
{{/* before our JS code gets loaded, use arrays to store errors, then the arrays will be switched to our error handler later */}}
|
|
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
|
window.addEventListener('unhandledrejection', 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}},
|
|
csrfToken: '{{.CsrfToken}}',
|
|
pageData: {{.PageData}},
|
|
notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
|
|
enableTimeTracking: {{EnableTimetracking}},
|
|
{{if or .Participants .Assignees .MentionableTeams}}
|
|
mentionValues: 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: {{ctx.Locale.Tr "copy_success"}},
|
|
copy_error: {{ctx.Locale.Tr "copy_error"}},
|
|
error_occurred: {{ctx.Locale.Tr "error.occurred"}},
|
|
network_error: {{ctx.Locale.Tr "error.network_error"}},
|
|
remove_label_str: {{ctx.Locale.Tr "remove_label_str"}},
|
|
modal_confirm: {{ctx.Locale.Tr "modal.confirm"}},
|
|
modal_cancel: {{ctx.Locale.Tr "modal.cancel"}},
|
|
more_items: {{ctx.Locale.Tr "more_items"}},
|
|
incorrect_root_url: {{ctx.Locale.Tr "incorrect_root_url" AppUrl}},
|
|
},
|
|
};
|
|
{{/* 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>
|