help: special url for .git mirror

Ref to 7a6bb5723a/options.js\#L57
Closes https://github.com/tuna/issues/issues/1703
This commit is contained in:
ZenithalHourlyRate 2023-03-24 21:35:49 +08:00
parent 60cd821146
commit 6e97a65364
No known key found for this signature in database
GPG Key ID: 1189C659F3D04C1C

View File

@ -14,8 +14,12 @@ $(document).ready(() => {
for (const target_selector of target_selectors) {
const template_selector = $(target_selector).data("template");
const select_selectors = $(target_selector).data("select").split(",");
let url = "/" + window.mirrorId
if (window.mirrorId.endsWith(".git")) {
url = "/git/" + window.mirrorId
}
const template_data = {
"mirror": "{{ site.hostname }}/" + window.mirrorId,
"mirror": "{{ site.hostname }}" + url,
};
for (const select_selector of select_selectors) {
const opt = $(select_selector).find('option:selected').data();