Check if reverse proxy is correctly configured (#30890)
Follow #27011 Follow #30885 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
b9396a9b85
commit
7424f27cf3
11 changed files with 93 additions and 19 deletions
6
web_src/js/bootstrap.js
vendored
6
web_src/js/bootstrap.js
vendored
|
@ -16,20 +16,20 @@ function shouldIgnoreError(err) {
|
|||
return false;
|
||||
}
|
||||
|
||||
export function showGlobalErrorMessage(msg) {
|
||||
export function showGlobalErrorMessage(msg, msgType = 'error') {
|
||||
const msgContainer = document.querySelector('.page-content') ?? document.body;
|
||||
const msgCompact = msg.replace(/\W/g, '').trim(); // compact the message to a data attribute to avoid too many duplicated messages
|
||||
let msgDiv = msgContainer.querySelector(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
|
||||
if (!msgDiv) {
|
||||
const el = document.createElement('div');
|
||||
el.innerHTML = `<div class="ui container negative message center aligned js-global-error tw-mt-[15px] tw-whitespace-pre-line"></div>`;
|
||||
el.innerHTML = `<div class="ui container js-global-error tw-my-[--page-spacing]"><div class="ui ${msgType} message tw-text-center tw-whitespace-pre-line"></div></div>`;
|
||||
msgDiv = el.childNodes[0];
|
||||
}
|
||||
// merge duplicated messages into "the message (count)" format
|
||||
const msgCount = Number(msgDiv.getAttribute(`data-global-error-msg-count`)) + 1;
|
||||
msgDiv.setAttribute(`data-global-error-msg-compact`, msgCompact);
|
||||
msgDiv.setAttribute(`data-global-error-msg-count`, msgCount.toString());
|
||||
msgDiv.textContent = msg + (msgCount > 1 ? ` (${msgCount})` : '');
|
||||
msgDiv.querySelector('.ui.message').textContent = msg + (msgCount > 1 ? ` (${msgCount})` : '');
|
||||
msgContainer.prepend(msgDiv);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue