Merge commit 'ac9bcabd9c2e6095a3298eedc6d9e2eda704e25d' into feature-clean

This commit is contained in:
2024-10-04 01:09:29 +03:00
36 changed files with 4985 additions and 6964 deletions

View File

@@ -57,7 +57,7 @@ export function createDisplayNames(
try {
return dict.of(lookup);
} catch (err) {
} catch {
console.warn(
`Failed to get display name for ${lookup} using dictionary for ${
this.resolvedOptions().locale

View File

@@ -1,21 +1,21 @@
import hljs from "highlight.js/lib/core";
// Scripting
import javascript from "highlight.js/lib/languages/javascript";
import python from "highlight.js/lib/languages/python";
import lua from "highlight.js/lib/languages/lua";
import python from "highlight.js/lib/languages/python";
// Coding
import groovy from "highlight.js/lib/languages/groovy";
import java from "highlight.js/lib/languages/java";
import kotlin from "highlight.js/lib/languages/kotlin";
import scala from "highlight.js/lib/languages/scala";
import groovy from "highlight.js/lib/languages/groovy";
// Configs
import { configuredXss, md } from "@modrinth/utils";
import gradle from "highlight.js/lib/languages/gradle";
import json from "highlight.js/lib/languages/json";
import ini from "highlight.js/lib/languages/ini";
import yaml from "highlight.js/lib/languages/yaml";
import xml from "highlight.js/lib/languages/xml";
import json from "highlight.js/lib/languages/json";
import properties from "highlight.js/lib/languages/properties";
import { md, configuredXss } from "@modrinth/utils";
import xml from "highlight.js/lib/languages/xml";
import yaml from "highlight.js/lib/languages/yaml";
/* REGISTRATION */
// Scripting
@@ -54,7 +54,7 @@ export const renderHighlightedString = (string) =>
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(str, { language: lang }).value;
} catch (__) {
} catch {
/* empty */
}
}

View File

@@ -1398,7 +1398,7 @@ try {
versions = shallowRef(toRaw(versions));
featuredVersions = shallowRef(toRaw(featuredVersions));
} catch (error) {
} catch {
throw createError({
fatal: true,
statusCode: 404,

View File

@@ -95,7 +95,7 @@ const props = defineProps<{
members: User[];
currentMember: User;
dependencies: Dependency[];
resetProject: Function;
resetProject: (opts?: { dedupe?: "cancel" | "defer" }) => Promise<void>;
}>();
const version = computed(() => {

View File

@@ -27,6 +27,7 @@ const windowsLink = ref(null);
const linuxLinks = {
appImage: null,
deb: null,
rpm: null,
thirdParty: "https://support.modrinth.com/en/articles/9298760",
};
const macLinks = {
@@ -57,6 +58,7 @@ macLinks.intel = launcherUpdates.value.platforms["darwin-x86_64"].install_urls[0
windowsLink.value = launcherUpdates.value.platforms["windows-x86_64"].install_urls[0];
linuxLinks.appImage = launcherUpdates.value.platforms["linux-x86_64"].install_urls[1];
linuxLinks.deb = launcherUpdates.value.platforms["linux-x86_64"].install_urls[0];
linuxLinks.rpm = launcherUpdates.value.platforms["linux-x86_64"].install_urls[2];
onMounted(() => {
os.value = navigator?.platform.toString();
@@ -879,7 +881,11 @@ useSeoMeta({
</a>
<a :href="linuxLinks.deb" download="">
<DownloadIcon />
<span> Download the Deb </span>
<span> Download the DEB </span>
</a>
<a :href="linuxLinks.rpm" download="">
<DownloadIcon />
<span> Download the RPM </span>
</a>
<a :href="linuxLinks.thirdParty" download="">
<LinkIcon />

View File

@@ -195,7 +195,7 @@ const onAuthorize = async () => {
}
throw new Error(formatMessage(messages.noRedirectUrlError));
} catch (error) {
} catch {
data.$notify({
group: "main",
title: formatMessage(commonMessages.errorNotificationTitle),
@@ -222,7 +222,7 @@ const onReject = async () => {
}
throw new Error(formatMessage(messages.noRedirectUrlError));
} catch (error) {
} catch {
data.$notify({
group: "main",
title: formatMessage(commonMessages.errorNotificationTitle),

View File

@@ -145,7 +145,7 @@ if (route.query.flow) {
await useAuth(auth.value.token);
}
}
} catch (err) {
} catch {
success.value = false;
}
}

View File

@@ -371,6 +371,22 @@
</div>
</section>
<section id="data-export" class="universal-card">
<h2>Data export</h2>
<p>
Request a copy of all your personal data you have uploaded to Modrinth. This may take
several minutes to complete.
</p>
<a v-if="generated" class="iconified-button" :href="generated" download="export.json">
<DownloadIcon />
Download export
</a>
<button v-else class="iconified-button" :disabled="generatingExport" @click="exportData">
<template v-if="generatingExport"> <UpdatedIcon /> Generating export... </template>
<template v-else> <UpdatedIcon /> Generate export </template>
</button>
</section>
<section id="delete-account" class="universal-card">
<h2>Delete account</h2>
<p>
@@ -391,16 +407,18 @@
<script setup>
import {
EditIcon,
SaveIcon,
TrashIcon,
PlusIcon,
SettingsIcon,
XIcon,
LeftArrowIcon,
RightArrowIcon,
CheckIcon,
EditIcon,
ExternalIcon,
LeftArrowIcon,
PlusIcon,
RightArrowIcon,
SaveIcon,
SettingsIcon,
TrashIcon,
UpdatedIcon,
XIcon,
DownloadIcon,
} from "@modrinth/assets";
import QrcodeVue from "qrcode.vue";
import GitHubIcon from "assets/icons/auth/sso-github.svg";
@@ -538,7 +556,7 @@ async function verifyTwoFactorCode() {
backupCodes.value = res.backup_codes;
twoFactorStep.value = 2;
await useAuth(auth.value.token);
} catch (err) {
} catch {
twoFactorIncorrect.value = true;
}
stopLoading();
@@ -555,7 +573,7 @@ async function removeTwoFactor() {
});
manageTwoFactorModal.value.hide();
await useAuth(auth.value.token);
} catch (err) {
} catch {
twoFactorIncorrect.value = true;
}
stopLoading();
@@ -614,6 +632,34 @@ async function deleteAccount() {
stopLoading();
}
const generatingExport = ref(false);
const generated = ref();
async function exportData() {
startLoading();
generatingExport.value = true;
try {
const res = await useBaseFetch("gdpr/export", {
method: "POST",
internal: true,
});
const jsonString = JSON.stringify(res, null, 2);
const blob = new Blob([jsonString], { type: "application/json" });
generated.value = URL.createObjectURL(blob);
} catch (err) {
data.$notify({
group: "main",
title: "An error occurred",
text: err.data.description,
type: "error",
});
}
generatingExport.value = false;
stopLoading();
}
</script>
<style lang="scss" scoped>
canvas {

View File

@@ -301,7 +301,7 @@ const canSubmit = computed(() => {
const url = new URL(uri);
return !!url;
});
} catch (err) {
} catch {
allValid = false;
}
return filledIn && (oneValid || allValid);

View File

@@ -226,7 +226,7 @@ async function changeLocale(value: string) {
try {
await vintl.changeLocale(value);
$failedLocale.value = undefined;
} catch (err) {
} catch {
$failedLocale.value = value;
} finally {
$changingTo.value = undefined;

View File

@@ -1,89 +1,110 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Modrinth App Ad</title>
<script
src="https://dn0qt3r0xannq.cloudfront.net/modrinth-7JfmkEIXEp/modrinth-longform/prebid-load.js"
async
></script>
<link rel="preload" href="https://www.googletagservices.com/tag/js/gpt.js" as="script" />
<style>
* {
margin: 0;
padding: 0;
overflow: hidden;
cursor: pointer;
}
.ads-container {
width: 100vw;
height: 100vh;
overflow: hidden;
position: relative;
}
#plus-link {
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
#modrinth-rail-1 {
border-radius: 1rem;
position: absolute;
left: 0;
top: 0;
z-index: 2;
}
</style>
</head>
<body>
<div class="ads-container">
<a id="plus-link" href="https://modrinth.com/plus" target="_blank"></a>
<div id="modrinth-rail-1" />
</div>
<script>
window.tude = window.tude || { cmd: [] };
tude.cmd.push(function () {
tude.refreshAdsViaDivMappings([
{
divId: "modrinth-rail-1",
baseDivId: "pb-slot-square-2",
},
]);
});
window.addEventListener(
"message",
(event) => {
if (event.data.modrinthAdClick && window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__.invoke("plugin:ads|record_ads_click", {});
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Modrinth App Ad</title>
<script
src="https://dn0qt3r0xannq.cloudfront.net/modrinth-7JfmkEIXEp/modrinth-longform/prebid-load.js"
async
></script>
<link rel="preload" href="https://www.googletagservices.com/tag/js/gpt.js" as="script" />
<style>
* {
margin: 0;
padding: 0;
overflow: hidden;
cursor: pointer;
}
if (event.data.modrinthOpenUrl && window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__.invoke("plugin:ads|open_link", {
path: event.data.modrinthOpenUrl,
origin: event.origin,
.ads-container {
width: 100vw;
height: 100vh;
overflow: hidden;
position: relative;
}
#plus-link {
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
#modrinth-rail-1 {
border-radius: 1rem;
position: absolute;
left: 0;
top: 0;
z-index: 2;
}
</style>
</head>
<body>
<div class="ads-container">
<div id="plus-link"></div>
<div id="modrinth-rail-1" />
</div>
<script>
function initAds(personalized) {
window.tude = window.tude || { cmd: [] };
tude.cmd.push(function () {
tude.refreshAdsViaDivMappings([
{
divId: "modrinth-rail-1",
baseDivId: "pb-slot-square-2",
},
]);
tude.setPrivacySettings({
personalizedAds: personalized ?? true,
});
});
}
},
false,
);
window.addEventListener("mousewheel", (event) => {
if (window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__.invoke("plugin:ads|scroll_ads_window", {
scroll: event.deltaY,
window.__TAURI_INTERNALS__
.invoke("plugin:ads|get_ads_personalization", {})
.then(initAds)
.catch(() => initAds(true));
window.addEventListener(
"message",
(event) => {
if (event.data.modrinthAdClick && window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__.invoke("plugin:ads|record_ads_click", {});
}
if (event.data.modrinthOpenUrl && window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__.invoke("plugin:ads|open_link", {
path: event.data.modrinthOpenUrl,
origin: event.origin,
});
}
},
false,
);
window.addEventListener("mousewheel", (event) => {
if (window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__.invoke("plugin:ads|scroll_ads_window", {
scroll: event.deltaY,
});
}
});
}
});
document.addEventListener("contextmenu", (event) => event.preventDefault());
</script>
</body>
document.addEventListener("contextmenu", (event) => event.preventDefault());
const plusLink = document.getElementById("plus-link");
plusLink.addEventListener("click", function () {
window.__TAURI_INTERNALS__.invoke("plugin:ads|record_ads_click", {});
window.__TAURI_INTERNALS__.invoke("plugin:ads|open_link", {
path: "https://modrinth.com/plus",
origin: "https://modrinth.com",
});
});
</script>
</body>
</html>