summaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-10-21 15:37:43 +0800
committerGitHub <noreply@github.com>2021-10-21 15:37:43 +0800
commit2add8fe9beede4aa82c913fcb70c0cf5bb1c6185 (patch)
treebe2555d0a8f0ae926d56eefd3a3b3e533985074a /web_src/js
parent5879ab83b5fab57a71aed4c8b3c4d9293b4a4398 (diff)
downloadgitea-2add8fe9beede4aa82c913fcb70c0cf5bb1c6185.tar.gz
gitea-2add8fe9beede4aa82c913fcb70c0cf5bb1c6185.zip
Frontend refactor, PascalCase to camelCase, remove unused code (#17365)
* Frontend refactor, PascalCase to camelCase, remove unused code * fix
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/components/ContextPopup.vue4
-rw-r--r--web_src/js/components/DashboardRepoList.js6
-rw-r--r--web_src/js/components/VueComponentLoader.js2
-rw-r--r--web_src/js/features/admin-common.js4
-rw-r--r--web_src/js/features/common-global.js16
-rw-r--r--web_src/js/features/comp/ImagePaste.js8
-rw-r--r--web_src/js/features/comp/MarkupContentPreview.js4
-rw-r--r--web_src/js/features/comp/ReactionSelector.js4
-rw-r--r--web_src/js/features/comp/SearchUserBox.js4
-rw-r--r--web_src/js/features/comp/WebHookEditor.js4
-rw-r--r--web_src/js/features/emoji.js10
-rw-r--r--web_src/js/features/issue-content-history.js10
-rw-r--r--web_src/js/features/lastcommitloader.js6
-rw-r--r--web_src/js/features/notification.js28
-rw-r--r--web_src/js/features/org-team.js4
-rw-r--r--web_src/js/features/projects.js16
-rw-r--r--web_src/js/features/repo-common.js4
-rw-r--r--web_src/js/features/repo-diff.js4
-rw-r--r--web_src/js/features/repo-editor.js6
-rw-r--r--web_src/js/features/repo-home.js8
-rw-r--r--web_src/js/features/repo-issue.js24
-rw-r--r--web_src/js/features/repo-legacy.js10
-rw-r--r--web_src/js/features/repo-migrate.js6
-rw-r--r--web_src/js/features/repo-settings.js8
-rw-r--r--web_src/js/features/repo-template.js4
-rw-r--r--web_src/js/features/repo-wiki.js4
-rw-r--r--web_src/js/features/serviceworker.js8
-rw-r--r--web_src/js/features/stopwatch.js26
-rw-r--r--web_src/js/features/tribute.js2
-rw-r--r--web_src/js/features/user-auth-u2f.js18
-rw-r--r--web_src/js/markup/mermaid.js6
-rw-r--r--web_src/js/markup/tasklist.js2
-rw-r--r--web_src/js/publicpath.js4
33 files changed, 137 insertions, 137 deletions
diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue
index be428b4776..efaa7be89e 100644
--- a/web_src/js/components/ContextPopup.vue
+++ b/web_src/js/components/ContextPopup.vue
@@ -22,7 +22,7 @@
<script>
import {SvgIcon} from '../svg.js';
-const {AppSubUrl} = window.config;
+const {appSubUrl} = window.config;
// NOTE: see models/issue_label.go for similar implementation
const srgbToLinear = (color) => {
@@ -112,7 +112,7 @@ export default {
methods: {
load(data, callback) {
this.loading = true;
- $.get(`${AppSubUrl}/api/v1/repos/${data.owner}/${data.repo}/issues/${data.index}`, (issue) => {
+ $.get(`${appSubUrl}/api/v1/repos/${data.owner}/${data.repo}/issues/${data.index}`, (issue) => {
this.issue = issue;
this.loading = false;
this.$nextTick(() => {
diff --git a/web_src/js/components/DashboardRepoList.js b/web_src/js/components/DashboardRepoList.js
index 426d362005..12e2ee3cc6 100644
--- a/web_src/js/components/DashboardRepoList.js
+++ b/web_src/js/components/DashboardRepoList.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import {initVueSvg, vueDelimiters} from './VueComponentLoader.js';
-const {AppSubUrl, AssetUrlPrefix, pageData} = window.config;
+const {appSubUrl, assetUrlPrefix, pageData} = window.config;
function initVueComponents() {
Vue.component('repo-search', {
@@ -95,7 +95,7 @@ function initVueComponents() {
finalPage: 1,
searchQuery,
isLoading: false,
- staticPrefix: AssetUrlPrefix,
+ staticPrefix: assetUrlPrefix,
counts: {},
repoTypes: {
all: {
@@ -361,7 +361,7 @@ export function initDashboardRepoList() {
data: () => {
return {
searchLimit: dashboardRepoListData.searchLimit || 0,
- subUrl: AppSubUrl,
+ subUrl: appSubUrl,
uid: dashboardRepoListData.uid || 0,
};
},
diff --git a/web_src/js/components/VueComponentLoader.js b/web_src/js/components/VueComponentLoader.js
index 110782bbb1..2979cd6a86 100644
--- a/web_src/js/components/VueComponentLoader.js
+++ b/web_src/js/components/VueComponentLoader.js
@@ -8,7 +8,7 @@ export function initVueEnv() {
if (vueEnvInited) return;
vueEnvInited = true;
- const isProd = window.config.IsProd;
+ const isProd = window.config.runModeIsProd;
Vue.config.productionTip = false;
Vue.config.devtools = !isProd;
}
diff --git a/web_src/js/features/admin-common.js b/web_src/js/features/admin-common.js
index 4f12c1846d..1a3f800080 100644
--- a/web_src/js/features/admin-common.js
+++ b/web_src/js/features/admin-common.js
@@ -1,4 +1,4 @@
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initAdminCommon() {
if ($('.admin').length === 0) {
@@ -204,7 +204,7 @@ export function initAdminCommon() {
}
});
$.post($this.data('link'), {
- _csrf: csrf,
+ _csrf: csrfToken,
ids
}).done(() => {
window.location.href = $this.data('redirect');
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 79cdac5def..bf4e97769d 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -4,7 +4,7 @@ import {initCompColorPicker} from './comp/ColorPicker.js';
import 'jquery.are-you-sure';
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initGlobalFormDirtyLeaveConfirm() {
// Warn users that try to leave a page after entering data into a form.
@@ -136,7 +136,7 @@ export async function initGlobalDropzone() {
const $dropzone = $(el);
await createDropzone(el, {
url: $dropzone.data('upload-url'),
- headers: {'X-Csrf-Token': csrf},
+ headers: {'X-Csrf-Token': csrfToken},
maxFiles: $dropzone.data('max-file'),
maxFilesize: $dropzone.data('max-size'),
acceptedFiles: (['*/*', ''].includes($dropzone.data('accepts'))) ? null : $dropzone.data('accepts'),
@@ -159,7 +159,7 @@ export async function initGlobalDropzone() {
if ($dropzone.data('remove-url')) {
$.post($dropzone.data('remove-url'), {
file: file.uuid,
- _csrf: csrf,
+ _csrf: csrfToken,
});
}
});
@@ -194,7 +194,7 @@ export function initGlobalLinkActions() {
}
const postData = {
- _csrf: csrf,
+ _csrf: csrfToken,
};
for (const [key, value] of Object.entries(dataArray)) {
if (key && key.startsWith('data')) {
@@ -232,7 +232,7 @@ export function initGlobalLinkActions() {
}
$.post($this.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
id: $this.data('id')
}).done((data) => {
window.location.href = data.redirect;
@@ -247,7 +247,7 @@ export function initGlobalLinkActions() {
const $this = $(this);
const redirect = $this.data('redirect');
$.post($this.data('url'), {
- _csrf: csrf
+ _csrf: csrfToken
}).done((data) => {
if (data.redirect) {
window.location.href = data.redirect;
@@ -270,7 +270,7 @@ export function initGlobalLinkActions() {
$('.undo-button').on('click', function () {
const $this = $(this);
$.post($this.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
id: $this.data('id')
}).done((data) => {
window.location.href = data.redirect;
@@ -298,7 +298,7 @@ export function initGlobalButtons() {
$('.delete-post.button').on('click', function () {
const $this = $(this);
$.post($this.data('request-url'), {
- _csrf: csrf
+ _csrf: csrfToken
}).done(() => {
window.location.href = $this.data('done-url');
});
diff --git a/web_src/js/features/comp/ImagePaste.js b/web_src/js/features/comp/ImagePaste.js
index b6881dd282..30c5820f62 100644
--- a/web_src/js/features/comp/ImagePaste.js
+++ b/web_src/js/features/comp/ImagePaste.js
@@ -1,4 +1,4 @@
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
async function uploadFile(file, uploadUrl) {
const formData = new FormData();
@@ -6,7 +6,7 @@ async function uploadFile(file, uploadUrl) {
const res = await fetch(uploadUrl, {
method: 'POST',
- headers: {'X-Csrf-Token': csrf},
+ headers: {'X-Csrf-Token': csrfToken},
body: formData,
});
return await res.json();
@@ -67,7 +67,7 @@ export function initCompImagePaste($target) {
const name = img.name.substr(0, img.name.lastIndexOf('.'));
insertAtCursor(textarea, `![${name}]()`);
const data = await uploadFile(img, uploadUrl);
- replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](${AppSubUrl}/attachments/${data.uuid})`);
+ replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](${appSubUrl}/attachments/${data.uuid})`);
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
dropzoneFiles.appendChild(input[0]);
}
@@ -83,7 +83,7 @@ export function initSimpleMDEImagePaste(simplemde, dropzone, files) {
const name = img.name.substr(0, img.name.lastIndexOf('.'));
const data = await uploadFile(img, uploadUrl);
const pos = simplemde.codemirror.getCursor();
- simplemde.codemirror.replaceRange(`![${name}](${AppSubUrl}/attachments/${data.uuid})`, pos);
+ simplemde.codemirror.replaceRange(`![${name}](${appSubUrl}/attachments/${data.uuid})`, pos);
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
files.append(input);
}
diff --git a/web_src/js/features/comp/MarkupContentPreview.js b/web_src/js/features/comp/MarkupContentPreview.js
index 0b05c4efae..ed0995296b 100644
--- a/web_src/js/features/comp/MarkupContentPreview.js
+++ b/web_src/js/features/comp/MarkupContentPreview.js
@@ -1,6 +1,6 @@
import {initMarkupContent} from '../../markup/content.js';
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initCompMarkupContentPreviewTab($form) {
const $tabMenu = $form.find('.tabular.menu');
@@ -8,7 +8,7 @@ export function initCompMarkupContentPreviewTab($form) {
$tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`).on('click', function () {
const $this = $(this);
$.post($this.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
mode: 'comment',
context: $this.data('context'),
text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
diff --git a/web_src/js/features/comp/ReactionSelector.js b/web_src/js/features/comp/ReactionSelector.js
index d11c9667b9..d77b8d3d4e 100644
--- a/web_src/js/features/comp/ReactionSelector.js
+++ b/web_src/js/features/comp/ReactionSelector.js
@@ -1,4 +1,4 @@
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initCompReactionSelector(parent) {
let reactions = '';
@@ -20,7 +20,7 @@ export function initCompReactionSelector(parent) {
type: 'POST',
url,
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
content: $(this).data('content')
}
}).done((resp) => {
diff --git a/web_src/js/features/comp/SearchUserBox.js b/web_src/js/features/comp/SearchUserBox.js
index 9019f17de3..0e7d122391 100644
--- a/web_src/js/features/comp/SearchUserBox.js
+++ b/web_src/js/features/comp/SearchUserBox.js
@@ -1,13 +1,13 @@
import {htmlEscape} from 'escape-goat';
-const {AppSubUrl} = window.config;
+const {appSubUrl} = window.config;
export function initSearchUserBox() {
const $searchUserBox = $('#search-user-box');
$searchUserBox.search({
minCharacters: 2,
apiSettings: {
- url: `${AppSubUrl}/api/v1/users/search?q={query}`,
+ url: `${appSubUrl}/api/v1/users/search?q={query}`,
onResponse(response) {
const items = [];
const searchQueryUppercase = $searchUserBox.find('input').val().toUpperCase();
diff --git a/web_src/js/features/comp/WebHookEditor.js b/web_src/js/features/comp/WebHookEditor.js
index 6911c6cb16..ddff73ee37 100644
--- a/web_src/js/features/comp/WebHookEditor.js
+++ b/web_src/js/features/comp/WebHookEditor.js
@@ -1,4 +1,4 @@
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initWebHookEditor() {
if ($('.new.webhook').length === 0) {
@@ -30,7 +30,7 @@ export function initWebHookEditor() {
const $this = $(this);
$this.addClass('loading disabled');
$.post($this.data('link'), {
- _csrf: csrf
+ _csrf: csrfToken
}).done(
setTimeout(() => {
window.location.href = $this.data('redirect');
diff --git a/web_src/js/features/emoji.js b/web_src/js/features/emoji.js
index 254a0b5c4d..304c564f3d 100644
--- a/web_src/js/features/emoji.js
+++ b/web_src/js/features/emoji.js
@@ -1,9 +1,9 @@
import emojis from '../../../assets/emoji.json';
-const {AssetUrlPrefix} = window.config;
-const {CustomEmojis} = window.config;
+const {assetUrlPrefix} = window.config;
+const {customEmojis} = window.config;
-const tempMap = {...CustomEmojis};
+const tempMap = {...customEmojis};
for (const {emoji, aliases} of emojis) {
for (const alias of aliases || []) {
tempMap[alias] = emoji;
@@ -24,8 +24,8 @@ for (const key of emojiKeys) {
// retrieve HTML for given emoji name
export function emojiHTML(name) {
let inner;
- if (Object.prototype.hasOwnProperty.call(CustomEmojis, name)) {
- inner = `<img alt=":${name}:" src="${AssetUrlPrefix}/img/emoji/${name}.png">`;
+ if (Object.prototype.hasOwnProperty.call(customEmojis, name)) {
+ inner = `<img alt=":${name}:" src="${assetUrlPrefix}/img/emoji/${name}.png">`;
} else {
inner = emojiString(name);
}
diff --git a/web_src/js/features/issue-content-history.js b/web_src/js/features/issue-content-history.js
index 6ead067417..3b830f50f8 100644
--- a/web_src/js/features/issue-content-history.js
+++ b/web_src/js/features/issue-content-history.js
@@ -1,6 +1,6 @@
import {svg} from '../svg.js';
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
let i18nTextEdited;
let i18nTextOptions;
@@ -37,7 +37,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
if (optionItem === 'delete') {
if (window.confirm(i18nTextDeleteFromHistoryConfirm)) {
$.post(`${issueBaseUrl}/content-history/soft-delete?comment_id=${commentId}&history_id=${historyId}`, {
- _csrf: csrf,
+ _csrf: csrfToken,
}).done((resp) => {
if (resp.ok) {
$dialog.modal('hide');
@@ -59,7 +59,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
$.ajax({
url: `${issueBaseUrl}/content-history/detail?comment_id=${commentId}&history_id=${historyId}`,
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
},
}).done((resp) => {
$dialog.find('.content').html(resp.diffHtml);
@@ -110,12 +110,12 @@ export function initIssueContentHistory() {
if (!issueIndex || !$itemIssue.length) return;
const repoLink = $('#repolink').val();
- const issueBaseUrl = `${AppSubUrl}/${repoLink}/issues/${issueIndex}`;
+ const issueBaseUrl = `${appSubUrl}/${repoLink}/issues/${issueIndex}`;
$.ajax({
url: `${issueBaseUrl}/content-history/overview`,
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
},
}).done((resp) => {
i18nTextEdited = resp.i18n.textEdited;
diff --git a/web_src/js/features/lastcommitloader.js b/web_src/js/features/lastcommitloader.js
index 964255f229..04e1e452ae 100644
--- a/web_src/js/features/lastcommitloader.js
+++ b/web_src/js/features/lastcommitloader.js
@@ -1,4 +1,4 @@
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export async function initLastCommitLoader() {
const entryMap = {};
@@ -18,7 +18,7 @@ export async function initLastCommitLoader() {
if (entries.length > 200) {
$.post(lastCommitLoaderURL, {
- _csrf: csrf,
+ _csrf: csrfToken,
}, (data) => {
$('table#repo-files-table').replaceWith(data);
});
@@ -26,7 +26,7 @@ export async function initLastCommitLoader() {
}
$.post(lastCommitLoaderURL, {
- _csrf: csrf,
+ _csrf: csrfToken,
'f': entries,
}, (data) => {
$(data).find('tr').each((_, row) => {
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js
index d1d829c90b..71ebb538d4 100644
--- a/web_src/js/features/notification.js
+++ b/web_src/js/features/notification.js
@@ -1,4 +1,4 @@
-const {AppSubUrl, csrf, NotificationSettings} = window.config;
+const {appSubUrl, csrfToken, notificationSettings} = window.config;
let notificationSequenceNumber = 0;
@@ -47,7 +47,7 @@ export async function initNotificationCount() {
return;
}
- if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
+ if (notificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
// Try to connect to the event source via the shared worker first
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');
worker.addEventListener('error', (event) => {
@@ -58,7 +58,7 @@ export async function initNotificationCount() {
});
worker.port.postMessage({
type: 'start',
- url: `${window.location.origin}${AppSubUrl}/user/events`,
+ url: `${window.location.origin}${appSubUrl}/user/events`,
});
worker.port.addEventListener('message', (event) => {
if (!event.data || !event.data.type) {
@@ -77,7 +77,7 @@ export async function initNotificationCount() {
type: 'close',
});
worker.port.close();
- window.location.href = AppSubUrl;
+ window.location.href = appSubUrl;
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',
@@ -99,7 +99,7 @@ export async function initNotificationCount() {
return;
}
- if (NotificationSettings.MinTimeout <= 0) {
+ if (notificationSettings.MinTimeout <= 0) {
return;
}
@@ -109,13 +109,13 @@ export async function initNotificationCount() {
}, timeout);
};
- fn(NotificationSettings.MinTimeout, notificationCount.text());
+ fn(notificationSettings.MinTimeout, notificationCount.text());
}
async function updateNotificationCountWithCallback(callback, timeout, lastCount) {
const currentCount = $('.notification_count').text();
if (lastCount !== currentCount) {
- callback(NotificationSettings.MinTimeout, currentCount);
+ callback(notificationSettings.MinTimeout, currentCount);
return;
}
@@ -124,9 +124,9 @@ async function updateNotificationCountWithCallback(callback, timeout, lastCount)
if (lastCount !== newCount) {
needsUpdate = true;
- timeout = NotificationSettings.MinTimeout;
- } else if (timeout < NotificationSettings.MaxTimeout) {
- timeout += NotificationSettings.TimeoutStep;
+ timeout = notificationSettings.MinTimeout;
+ } else if (timeout < notificationSettings.MaxTimeout) {
+ timeout += notificationSettings.TimeoutStep;
}
callback(timeout, newCount);
@@ -140,7 +140,7 @@ async function updateNotificationTable() {
if (notificationDiv.length > 0) {
const data = await $.ajax({
type: 'GET',
- url: `${AppSubUrl}/notifications?${notificationDiv.data('params')}`,
+ url: `${appSubUrl}/notifications?${notificationDiv.data('params')}`,
data: {
'div-only': true,
'sequence-number': ++notificationSequenceNumber,
@@ -156,9 +156,9 @@ async function updateNotificationTable() {
async function updateNotificationCount() {
const data = await $.ajax({
type: 'GET',
- url: `${AppSubUrl}/api/v1/notifications/new`,
+ url: `${appSubUrl}/api/v1/notifications/new`,
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
},
});
@@ -183,7 +183,7 @@ async function updateNotification(url, status, page, q, notificationID) {
type: 'POST',
url,
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
notification_id: notificationID,
status,
page,
diff --git a/web_src/js/features/org-team.js b/web_src/js/features/org-team.js
index d6492965ff..ea0ea5fe74 100644
--- a/web_src/js/features/org-team.js
+++ b/web_src/js/features/org-team.js
@@ -1,4 +1,4 @@
-const {AppSubUrl} = window.config;
+const {appSubUrl} = window.config;
export function initOrgTeamSettings() {
// Change team access mode
@@ -18,7 +18,7 @@ export function initOrgTeamSearchRepoBox() {
$searchRepoBox.search({
minCharacters: 2,
apiSettings: {
- url: `${AppSubUrl}/api/v1/repos/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
+ url: `${appSubUrl}/api/v1/repos/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
onResponse(response) {
const items = [];
$.each(response.data, (_i, item) => {
diff --git a/web_src/js/features/projects.js b/web_src/js/features/projects.js
index c02b81d1c6..736c09661d 100644
--- a/web_src/js/features/projects.js
+++ b/web_src/js/features/projects.js
@@ -1,7 +1,7 @@
-const {csrf, PageIsProjects} = window.config;
+const {csrfToken} = window.config;
export default async function initProject() {
- if (!PageIsProjects) {
+ if (!$('.repository.projects').length) {
return;
}
@@ -25,7 +25,7 @@ export default async function initProject() {
url: $(column).data('url'),
data: JSON.stringify({sorting: i, color: rgbToHex($(column).css('backgroundColor'))}),
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
@@ -47,7 +47,7 @@ export default async function initProject() {
onAdd: (e) => {
$.ajax(`${e.to.dataset.url}/${e.item.dataset.issue}`, {
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
@@ -83,7 +83,7 @@ export default async function initProject() {
url: $(this).data('url'),
data: JSON.stringify({title: projectTitleInput.val(), color: projectColorInput.val()}),
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
@@ -107,7 +107,7 @@ export default async function initProject() {
method: 'POST',
url: $(this).data('url'),
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
@@ -123,7 +123,7 @@ export default async function initProject() {
$.ajax({
url: $(this).data('url'),
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
@@ -144,7 +144,7 @@ export default async function initProject() {
url: $(this).data('url'),
data: JSON.stringify({title: boardTitle.val(), color: projectColorInput.val()}),
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
diff --git a/web_src/js/features/repo-common.js b/web_src/js/features/repo-common.js
index c050dba34c..2ae4f9c94e 100644
--- a/web_src/js/features/repo-common.js
+++ b/web_src/js/features/repo-common.js
@@ -1,11 +1,11 @@
-const {csrf} = window.config;
+const {csrfToken} = window.config;
function getArchive($target, url, first) {
$.ajax({
url,
type: 'POST',
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
},
complete(xhr) {
if (xhr.status === 200) {
diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js
index 52b68a7d4f..c3fb78a683 100644
--- a/web_src/js/features/repo-diff.js
+++ b/web_src/js/features/repo-diff.js
@@ -1,6 +1,6 @@
import {initCompReactionSelector} from './comp/ReactionSelector.js';
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initRepoDiffReviewButton() {
$(document).on('click', 'button[name="is_review"]', (e) => {
@@ -45,7 +45,7 @@ export function initRepoDiffConversationForm() {
const action = $(this).data('action');
const url = $(this).data('update-url');
- const data = await $.post(url, {_csrf: csrf, origin, action, comment_id});
+ const data = await $.post(url, {_csrf: csrfToken, origin, action, comment_id});
if ($(this).closest('.conversation-holder').length) {
const conversation = $(data);
diff --git a/web_src/js/features/repo-editor.js b/web_src/js/features/repo-editor.js
index 831b621fde..e2acaafd12 100644
--- a/web_src/js/features/repo-editor.js
+++ b/web_src/js/features/repo-editor.js
@@ -1,7 +1,7 @@
import {initMarkupContent} from '../markup/content.js';
import {createCodeEditor} from './codeeditor.js';
-const {csrf} = window.config;
+const {csrfToken} = window.config;
let previewFileModes;
@@ -21,7 +21,7 @@ function initEditPreviewTab($form) {
}
context = context.substring(0, context.lastIndexOf('/'));
$.post($this.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
mode,
context,
text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
@@ -40,7 +40,7 @@ function initEditDiffTab($form) {
$tabMenu.find(`.item[data-tab="${$tabMenu.data('diff')}"]`).on('click', function () {
const $this = $(this);
$.post($this.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
context: $this.data('context'),
content: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
}, (data) => {
diff --git a/web_src/js/features/repo-home.js b/web_src/js/features/repo-home.js
index 142698f074..f8bf9318ce 100644
--- a/web_src/js/features/repo-home.js
+++ b/web_src/js/features/repo-home.js
@@ -1,6 +1,6 @@
import {stripTags} from '../utils.js';
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
export function initRepoTopicBar() {
const mgrBtn = $('#manage_topic');
@@ -30,7 +30,7 @@ export function initRepoTopicBar() {
const topics = $('input[name=topics]').val();
$.post(saveBtn.data('link'), {
- _csrf: csrf,
+ _csrf: csrfToken,
topics
}, (_data, _textStatus, xhr) => {
if (xhr.responseJSON.status === 'ok') {
@@ -41,7 +41,7 @@ export function initRepoTopicBar() {
const last = viewDiv.children('a').last();
for (let i = 0; i < topicArray.length; i++) {
const link = $('<a class="ui repo-topic large label topic"></a>');
- link.attr('href', `${AppSubUrl}/explore/repos?q=${encodeURIComponent(topicArray[i])}&topic=1`);
+ link.attr('href', `${appSubUrl}/explore/repos?q=${encodeURIComponent(topicArray[i])}&topic=1`);
link.text(topicArray[i]);
link.insertBefore(last);
}
@@ -90,7 +90,7 @@ export function initRepoTopicBar() {
label: 'ui small label'
},
apiSettings: {
- url: `${AppSubUrl}/api/v1/topics/search?q={query}`,
+ url: `${appSubUrl}/api/v1/topics/search?q={query}`,
throttle: 500,
cache: false,
onResponse(res) {
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index 858398aac9..c95b6c1307 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -4,7 +4,7 @@ import {createCommentSimpleMDE} from './comp/CommentSimpleMDE.js';
import {initCompImagePaste} from './comp/ImagePaste.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
export function initRepoIssueTimeTracking() {
$(document).on('click', '.issue-add-time', () => {
@@ -58,7 +58,7 @@ function updateDeadline(deadlineString) {
due_date: realDeadline,
}),
headers: {
- 'X-Csrf-Token': csrf,
+ 'X-Csrf-Token': csrfToken,
'X-Remote': true,
},
contentType: 'application/json',
@@ -91,9 +91,9 @@ export function initRepoIssueList() {
const repoId = $('#repoId').val();
const crossRepoSearch = $('#crossRepoSearch').val();
const tp = $('#type').val();
- let issueSearchUrl = `${AppSubUrl}/api/v1/repos/${repolink}/issues?q={query}&type=${tp}`;
+ let issueSearchUrl = `${appSubUrl}/api/v1/repos/${repolink}/issues?q={query}&type=${tp}`;
if (crossRepoSearch === 'true') {
- issueSearchUrl = `${AppSubUrl}/api/v1/repos/issues/search?q={query}&priority_repo_id=${repoId}&type=${tp}`;
+ issueSearchUrl = `${appSubUrl}/api/v1/repos/issues/search?q={query}&priority_repo_id=${repoId}&type=${tp}`;
}
$('#new-dependency-drop-list')
.dropdown({
@@ -157,7 +157,7 @@ export function initRepoIssueCommentDelete() {
const $this = $(this);
if (window.confirm($this.data('locale'))) {
$.post($this.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
}).done(() => {
const $conversationHolder = $this.closest('.conversation-holder');
$(`#${$this.data('comment-id')}`).remove();
@@ -258,7 +258,7 @@ export function initRepoPullRequestUpdate() {
const redirect = $this.data('redirect');
$this.addClass('loading');
$.post($this.data('do'), {
- _csrf: csrf
+ _csrf: csrfToken
}).done((data) => {
if (data.redirect) {
window.location.href = data.redirect;
@@ -291,7 +291,7 @@ export function initRepoIssueReferenceRepositorySearch() {
$('.issue_reference_repository_search')
.dropdown({
apiSettings: {
- url: `${AppSubUrl}/api/v1/repos/search?q={query}&limit=20`,
+ url: `${appSubUrl}/api/v1/repos/search?q={query}&limit=20`,
onResponse(response) {
const filteredResponse = {success: true, results: []};
$.each(response.data, (_r, repo) => {
@@ -306,7 +306,7 @@ export function initRepoIssueReferenceRepositorySearch() {
},
onChange(_value, _text, $choice) {
const $form = $choice.closest('form');
- $form.attr('action', `${AppSubUrl}/${_text}/issues/new`);
+ $form.attr('action', `${appSubUrl}/${_text}/issues/new`);
},
fullTextSearch: true
});
@@ -338,7 +338,7 @@ export function updateIssuesMeta(url, action, issueIds, elementId) {
type: 'POST',
url,
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
action,
issue_ids: issueIds,
id: elementId,
@@ -556,7 +556,7 @@ export function initRepoIssueWipToggle() {
e.preventDefault();
const {title, wipPrefix, updateUrl} = e.currentTarget.closest('.toggle-wip').dataset;
await $.post(updateUrl, {
- _csrf: csrf,
+ _csrf: csrfToken,
title: title?.startsWith(wipPrefix) ? title.substr(wipPrefix.length).trim() : `${wipPrefix.trim()} ${title}`,
});
window.location.reload();
@@ -591,7 +591,7 @@ export function initRepoIssueTitleEdit() {
return false;
}
$.post(update_url, {
- _csrf: csrf,
+ _csrf: csrfToken,
target_branch: targetBranch
}).done((data) => {
$branchTarget.text(data.base_branch);
@@ -606,7 +606,7 @@ export function initRepoIssueTitleEdit() {
pullrequest_targetbranch_change(pullrequest_target_update_url);
} else {
$.post($(this).data('update-url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
title: $editInput.val()
}, (data) => {
$editInput.val(data.title);
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index a1c405d719..2e98a7183e 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -27,7 +27,7 @@ import {initCommentContent, initMarkupContent} from '../markup/content.js';
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoSettingBranches} from './repo-settings.js';
-const {csrf} = window.config;
+const {csrfToken} = window.config;
const commentMDEditors = {};
@@ -54,7 +54,7 @@ export function initRepoCommentForm() {
if (editMode === 'true') {
const form = $('#update_issueref_form');
- $.post(form.attr('action'), {_csrf: csrf, ref: selectedValue}, () => window.location.reload());
+ $.post(form.attr('action'), {_csrf: csrfToken, ref: selectedValue}, () => window.location.reload());
} else if (editMode === '') {
$selectBranch.find('.ui .branch-name').text(selectedValue);
}
@@ -370,7 +370,7 @@ export async function initRepository() {
const fileUuidDict = {};
dz = await createDropzone($dropzone[0], {
url: $dropzone.data('upload-url'),
- headers: {'X-Csrf-Token': csrf},
+ headers: {'X-Csrf-Token': csrfToken},
maxFiles: $dropzone.data('max-file'),
maxFilesize: $dropzone.data('max-size'),
acceptedFiles: (['*/*', ''].includes($dropzone.data('accepts'))) ? null : $dropzone.data('accepts'),
@@ -396,7 +396,7 @@ export async function initRepository() {
if ($dropzone.data('remove-url') && !fileUuidDict[file.uuid].submitted) {
$.post($dropzone.data('remove-url'), {
file: file.uuid,
- _csrf: csrf,
+ _csrf: csrfToken,
});
}
});
@@ -458,7 +458,7 @@ export async function initRepository() {
return $(this).val();
}).get();
$.post($editContentZone.data('update-url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
content: $textarea.val(),
context: $editContentZone.data('context'),
files: $attachments,
diff --git a/web_src/js/features/repo-migrate.js b/web_src/js/features/repo-migrate.js
index 872dbc34f5..2779fcd24c 100644
--- a/web_src/js/features/repo-migrate.js
+++ b/web_src/js/features/repo-migrate.js
@@ -1,4 +1,4 @@
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
export function initRepoMigrationStatusChecker() {
const migrating = $('#repo_migrating');
@@ -12,9 +12,9 @@ export function initRepoMigrationStatusChecker() {
}
$.ajax({
type: 'GET',
- url: `${AppSubUrl}/user/task/${task}`,
+ url: `${appSubUrl}/user/task/${task}`,
data: {
- _csrf: csrf,
+ _csrf: csrfToken,
},
complete(xhr) {
if (xhr.status === 200 && xhr.responseJSON) {
diff --git a/web_src/js/features/repo-settings.js b/web_src/js/features/repo-settings.js
index e063448936..bd42bcb441 100644
--- a/web_src/js/features/repo-settings.js
+++ b/web_src/js/features/repo-settings.js
@@ -1,14 +1,14 @@
import {createMonaco} from './codeeditor.js';
import {initRepoCommonFilterSearchDropdown} from './repo-common.js';
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
export function initRepoSettingsCollaboration() {
// Change collaborator access mode
$('.access-mode.menu .item').on('click', function () {
const $menu = $(this).parent();
$.post($menu.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
uid: $menu.data('uid'),
mode: $(this).data('value')
});
@@ -20,8 +20,8 @@ export function initRepoSettingSearchTeamBox() {
$searchTeamBox.search({
minCharacters: 2,
apiSettings: {
- url: `${AppSubUrl}/api/v1/orgs/${$searchTeamBox.data('org')}/teams/search?q={query}`,
- headers: {'X-Csrf-Token': csrf},
+ url: `${appSubUrl}/api/v1/orgs/${$searchTeamBox.data('org')}/teams/search?q={query}`,
+ headers: {'X-Csrf-Token': csrfToken},
onResponse(response) {
const items = [];
$.each(response.data, (_i, item) => {
diff --git a/web_src/js/features/repo-template.js b/web_src/js/features/repo-template.js
index 9385e2acb8..5c100a89c5 100644
--- a/web_src/js/features/repo-template.js
+++ b/web_src/js/features/repo-template.js
@@ -1,6 +1,6 @@
import {htmlEscape} from 'escape-goat';
-const {AppSubUrl} = window.config;
+const {appSubUrl} = window.config;
export function initRepoTemplateSearch() {
const $repoTemplate = $('#repo_template');
@@ -22,7 +22,7 @@ export function initRepoTemplateSearch() {
$('#repo_template_search')
.dropdown({
apiSettings: {
- url: `${AppSubUrl}/api/v1/repos/search?q={query}&template=true&priority_owner_id=${$('#uid').val()}`,
+ url: `${appSubUrl}/api/v1/repos/search?q={query}&template=true&priority_owner_id=${$('#uid').val()}`,
onResponse(response) {
const filteredResponse = {success: true, results: []};
filteredResponse.results.push({
diff --git a/web_src/js/features/repo-wiki.js b/web_src/js/features/repo-wiki.js
index aad3161fdb..ddd4e30a8a 100644
--- a/web_src/js/features/repo-wiki.js
+++ b/web_src/js/features/repo-wiki.js
@@ -1,7 +1,7 @@
import {initMarkupContent} from '../markup/content.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
-const {csrf} = window.config;
+const {csrfToken} = window.config;
export function initRepoWikiForm() {
const $editArea = $('.repository.wiki textarea#edit_area');
@@ -22,7 +22,7 @@ export function initRepoWikiForm() {
sideBySideTimeout = null;
}
$.post($editArea.data('url'), {
- _csrf: csrf,
+ _csrf: csrfToken,
mode: 'gfm',
context: $editArea.data('context'),
text: plainText,
diff --git a/web_src/js/features/serviceworker.js b/web_src/js/features/serviceworker.js
index 37cd15c5bd..f3998d98f9 100644
--- a/web_src/js/features/serviceworker.js
+++ b/web_src/js/features/serviceworker.js
@@ -1,8 +1,8 @@
import {joinPaths} from '../utils.js';
-const {UseServiceWorker, AssetUrlPrefix, AppVer} = window.config;
+const {useServiceWorker, assetUrlPrefix, appVer} = window.config;
const cachePrefix = 'static-cache-v'; // actual version is set in the service worker script
-const workerAssetPath = joinPaths(AssetUrlPrefix, 'serviceworker.js');
+const workerAssetPath = joinPaths(assetUrlPrefix, 'serviceworker.js');
async function unregisterAll() {
for (const registration of await navigator.serviceWorker.getRegistrations()) {
@@ -24,7 +24,7 @@ async function invalidateCache() {
}
async function checkCacheValidity() {
- const cacheKey = AppVer;
+ const cacheKey = appVer;
const storedCacheKey = localStorage.getItem('staticCacheKey');
// invalidate cache if it belongs to a different gitea version
@@ -37,7 +37,7 @@ async function checkCacheValidity() {
export default async function initServiceWorker() {
if (!('serviceWorker' in navigator)) return;
- if (UseServiceWorker) {
+ if (useServiceWorker) {
// unregister all service workers where scriptURL does not match the current one
await unregisterOtherWorkers();
try {
diff --git a/web_src/js/features/stopwatch.js b/web_src/js/features/stopwatch.js
index eb59e587a7..8364569892 100644
--- a/web_src/js/features/stopwatch.js
+++ b/web_src/js/features/stopwatch.js
@@ -1,10 +1,10 @@
import prettyMilliseconds from 'pretty-ms';
-const {AppSubUrl, csrf, NotificationSettings, EnableTimetracking} = window.config;
+const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.config;
let updateTimeInterval = null; // holds setInterval id when active
export async function initStopwatch() {
- if (!EnableTimetracking) {
+ if (!enableTimeTracking) {
return;
}
@@ -25,7 +25,7 @@ export async function initStopwatch() {
$(this).parent().trigger('submit');
});
- if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
+ if (notificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
// Try to connect to the event source via the shared worker first
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');
worker.addEventListener('error', (event) => {
@@ -36,7 +36,7 @@ export async function initStopwatch() {
});
worker.port.postMessage({
type: 'start',
- url: `${window.location.origin}${AppSubUrl}/user/events`,
+ url: `${window.location.origin}${appSubUrl}/user/events`,
});
worker.port.addEventListener('message', (event) => {
if (!event.data || !event.data.type) {
@@ -55,7 +55,7 @@ export async function initStopwatch() {
type: 'close',
});
worker.port.close();
- window.location.href = AppSubUrl;
+ window.location.href = appSubUrl;
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',
@@ -77,7 +77,7 @@ export async function initStopwatch() {
return;
}
- if (NotificationSettings.MinTimeout <= 0) {
+ if (notificationSettings.MinTimeout <= 0) {
return;
}
@@ -87,7 +87,7 @@ export async function initStopwatch() {
}, timeout);
};
- fn(NotificationSettings.MinTimeout);
+ fn(notificationSettings.MinTimeout);
const currSeconds = $('.stopwatch-time').data('seconds');
if (currSeconds) {
@@ -99,9 +99,9 @@ async function updateStopwatchWithCallback(callback, timeout) {
const isSet = await updateStopwatch();
if (!isSet) {
- timeout = NotificationSettings.MinTimeout;
- } else if (timeout < NotificationSettings.MaxTimeout) {
- timeout += NotificationSettings.TimeoutStep;
+ timeout = notificationSettings.MinTimeout;
+ } else if (timeout < notificationSettings.MaxTimeout) {
+ timeout += notificationSettings.TimeoutStep;
}
callback(timeout);
@@ -110,8 +110,8 @@ async function updateStopwatchWithCallback(callback, timeout) {
async function updateStopwatch() {
const data = await $.ajax({
type: 'GET',
- url: `${AppSubUrl}/api/v1/user/stopwatches`,
- headers: {'X-Csrf-Token': csrf},
+ url: `${appSubUrl}/api/v1/user/stopwatches`,
+ headers: {'X-Csrf-Token': csrfToken},
});
if (updateTimeInterval) {
@@ -129,7 +129,7 @@ async function updateStopwatchData(data) {
btnEl.addClass('hidden');
} else {
const {repo_owner_name, repo_name, issue_index, seconds} = watch;
- const issueUrl = `${AppSubUrl}/${repo_owner_name}/${repo_name}/issues/${issue_index}`;
+ const issueUrl = `${appSubUrl}/${repo_owner_name}/${repo_name}/issues/${issue_index}`;
$('.stopwatch-link').attr('href', issueUrl);
$('.stopwatch-commit').attr('action', `${issueUrl}/times/stopwatch/toggle`);
$('.stopwatch-cancel').attr('action', `${issueUrl}/times/stopwatch/cancel`);
diff --git a/web_src/js/features/tribute.js b/web_src/js/features/tribute.js
index 6fdb2f5df0..053804c43d 100644
--- a/web_src/js/features/tribute.js
+++ b/web_src/js/features/tribute.js
@@ -49,7 +49,7 @@ function makeCollections({mentions, emoji}) {
}
export default async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) {
- if (!window.config.Tribute || !elementOrNodeList) return;
+ if (!window.config.requireTribute || !elementOrNodeList) return;
const nodes = Array.from('length' in elementOrNodeList ? elementOrNodeList : [elementOrNodeList]);
if (!nodes.length) return;
diff --git a/web_src/js/features/user-auth-u2f.js b/web_src/js/features/user-auth-u2f.js
index 25255213a8..15beaaa207 100644
--- a/web_src/js/features/user-auth-u2f.js
+++ b/web_src/js/features/user-auth-u2f.js
@@ -1,11 +1,11 @@
-const {AppSubUrl, csrf} = window.config;
+const {appSubUrl, csrfToken} = window.config;
export function initUserAuthU2fAuth() {
if ($('#wait-for-key').length === 0) {
return;
}
u2fApi.ensureSupport().then(() => {
- $.getJSON(`${AppSubUrl}/user/u2f/challenge`).done((req) => {
+ $.getJSON(`${appSubUrl}/user/u2f/challenge`).done((req) => {
u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30)
.then(u2fSigned)
.catch((err) => {
@@ -18,15 +18,15 @@ export function initUserAuthU2fAuth() {
});
}).catch(() => {
// Fallback in case browser do not support U2F
- window.location.href = `${AppSubUrl}/user/two_factor`;
+ window.location.href = `${appSubUrl}/user/two_factor`;
});
}
function u2fSigned(resp) {
$.ajax({
- url: `${AppSubUrl}/user/u2f/sign`,
+ url: `${appSubUrl}/user/u2f/sign`,
type: 'POST',
- headers: {'X-Csrf-Token': csrf},
+ headers: {'X-Csrf-Token': csrfToken},
data: JSON.stringify(resp),
contentType: 'application/json; charset=utf-8',
}).done((res) => {
@@ -41,9 +41,9 @@ function u2fRegistered(resp) {
return;
}
$.ajax({
- url: `${AppSubUrl}/user/settings/security/u2f/register`,
+ url: `${appSubUrl}/user/settings/security/u2f/register`,
type: 'POST',
- headers: {'X-Csrf-Token': csrf},
+ headers: {'X-Csrf-Token': csrfToken},
data: JSON.stringify(resp),
contentType: 'application/json; charset=utf-8',
success() {
@@ -99,8 +99,8 @@ export function initUserAuthU2fRegister() {
}
function u2fRegisterRequest() {
- $.post(`${AppSubUrl}/user/settings/security/u2f/request_register`, {
- _csrf: csrf,
+ $.post(`${appSubUrl}/user/settings/security/u2f/request_register`, {
+ _csrf: csrfToken,
name: $('#nickname').val()
}).done((req) => {
$('#nickname').closest('div.field').removeClass('error');
diff --git a/web_src/js/markup/mermaid.js b/web_src/js/markup/mermaid.js
index 0319cbb6f0..f9f069ed1e 100644
--- a/web_src/js/markup/mermaid.js
+++ b/web_src/js/markup/mermaid.js
@@ -1,4 +1,4 @@
-const {MermaidMaxSourceCharacters} = window.config;
+const {mermaidMaxSourceCharacters} = window.config;
function displayError(el, err) {
el.closest('pre').classList.remove('is-loading');
@@ -26,8 +26,8 @@ export async function renderMermaid(els) {
});
for (const el of els) {
- if (MermaidMaxSourceCharacters >= 0 && el.textContent.length > MermaidMaxSourceCharacters) {
- displayError(el, new Error(`Mermaid source of ${el.textContent.length} characters exceeds the maximum allowed length of ${MermaidMaxSourceCharacters}.`));
+ if (mermaidMaxSourceCharacters >= 0 && el.textContent.length > mermaidMaxSourceCharacters) {
+ displayError(el, new Error(`Mermaid source of ${el.textContent.length} characters exceeds the maximum allowed length of ${mermaidMaxSourceCharacters}.`));
continue;
}
diff --git a/web_src/js/markup/tasklist.js b/web_src/js/markup/tasklist.js
index ea1a1f824a..f8ca5b0406 100644
--- a/web_src/js/markup/tasklist.js
+++ b/web_src/js/markup/tasklist.js
@@ -47,7 +47,7 @@ export function initMarkupTasklist() {
await $.post(updateUrl, {
ignore_attachments: true,
- _csrf: window.config.csrf,
+ _csrf: window.config.csrfToken,
content: newContent,
context
});
diff --git a/web_src/js/publicpath.js b/web_src/js/publicpath.js
index b68a91d860..44448a8447 100644
--- a/web_src/js/publicpath.js
+++ b/web_src/js/publicpath.js
@@ -1,6 +1,6 @@
// This sets up the URL prefix used in webpack's chunk loading.
// This file must be imported before any lazy-loading is being attempted.
import {joinPaths} from './utils.js';
-const {AssetUrlPrefix} = window.config;
+const {assetUrlPrefix} = window.config;
-__webpack_public_path__ = joinPaths(AssetUrlPrefix, '/');
+__webpack_public_path__ = joinPaths(assetUrlPrefix, '/');