parent
9708685506
commit
e81a4ade97
@ -2,10 +2,8 @@ use serde::Serialize;
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use tauri::plugin::TauriPlugin;
|
use tauri::plugin::TauriPlugin;
|
||||||
use tauri::{
|
use tauri::{Emitter, LogicalPosition, LogicalSize, Manager, Runtime};
|
||||||
Emitter, Listener, LogicalPosition, LogicalSize, Manager, Runtime,
|
use tauri_plugin_shell::ShellExt;
|
||||||
};
|
|
||||||
use tauri_plugin_shell::{open, ShellExt};
|
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
pub struct AdsState {
|
pub struct AdsState {
|
||||||
|
|||||||
@ -57,7 +57,7 @@ export function createDisplayNames(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return dict.of(lookup);
|
return dict.of(lookup);
|
||||||
} catch (err) {
|
} catch {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Failed to get display name for ${lookup} using dictionary for ${
|
`Failed to get display name for ${lookup} using dictionary for ${
|
||||||
this.resolvedOptions().locale
|
this.resolvedOptions().locale
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
import hljs from "highlight.js/lib/core";
|
import hljs from "highlight.js/lib/core";
|
||||||
// Scripting
|
// Scripting
|
||||||
import javascript from "highlight.js/lib/languages/javascript";
|
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 lua from "highlight.js/lib/languages/lua";
|
||||||
|
import python from "highlight.js/lib/languages/python";
|
||||||
// Coding
|
// Coding
|
||||||
|
import groovy from "highlight.js/lib/languages/groovy";
|
||||||
import java from "highlight.js/lib/languages/java";
|
import java from "highlight.js/lib/languages/java";
|
||||||
import kotlin from "highlight.js/lib/languages/kotlin";
|
import kotlin from "highlight.js/lib/languages/kotlin";
|
||||||
import scala from "highlight.js/lib/languages/scala";
|
import scala from "highlight.js/lib/languages/scala";
|
||||||
import groovy from "highlight.js/lib/languages/groovy";
|
|
||||||
// Configs
|
// Configs
|
||||||
|
import { configuredXss, md } from "@modrinth/utils";
|
||||||
import gradle from "highlight.js/lib/languages/gradle";
|
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 ini from "highlight.js/lib/languages/ini";
|
||||||
import yaml from "highlight.js/lib/languages/yaml";
|
import json from "highlight.js/lib/languages/json";
|
||||||
import xml from "highlight.js/lib/languages/xml";
|
|
||||||
import properties from "highlight.js/lib/languages/properties";
|
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 */
|
/* REGISTRATION */
|
||||||
// Scripting
|
// Scripting
|
||||||
@ -54,7 +54,7 @@ export const renderHighlightedString = (string) =>
|
|||||||
if (lang && hljs.getLanguage(lang)) {
|
if (lang && hljs.getLanguage(lang)) {
|
||||||
try {
|
try {
|
||||||
return hljs.highlight(str, { language: lang }).value;
|
return hljs.highlight(str, { language: lang }).value;
|
||||||
} catch (__) {
|
} catch {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1398,7 +1398,7 @@ try {
|
|||||||
|
|
||||||
versions = shallowRef(toRaw(versions));
|
versions = shallowRef(toRaw(versions));
|
||||||
featuredVersions = shallowRef(toRaw(featuredVersions));
|
featuredVersions = shallowRef(toRaw(featuredVersions));
|
||||||
} catch (error) {
|
} catch {
|
||||||
throw createError({
|
throw createError({
|
||||||
fatal: true,
|
fatal: true,
|
||||||
statusCode: 404,
|
statusCode: 404,
|
||||||
|
|||||||
@ -95,7 +95,7 @@ const props = defineProps<{
|
|||||||
members: User[];
|
members: User[];
|
||||||
currentMember: User;
|
currentMember: User;
|
||||||
dependencies: Dependency[];
|
dependencies: Dependency[];
|
||||||
resetProject: Function;
|
resetProject: (opts?: { dedupe?: "cancel" | "defer" }) => Promise<void>;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const version = computed(() => {
|
const version = computed(() => {
|
||||||
|
|||||||
@ -195,7 +195,7 @@ const onAuthorize = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(formatMessage(messages.noRedirectUrlError));
|
throw new Error(formatMessage(messages.noRedirectUrlError));
|
||||||
} catch (error) {
|
} catch {
|
||||||
data.$notify({
|
data.$notify({
|
||||||
group: "main",
|
group: "main",
|
||||||
title: formatMessage(commonMessages.errorNotificationTitle),
|
title: formatMessage(commonMessages.errorNotificationTitle),
|
||||||
@ -222,7 +222,7 @@ const onReject = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(formatMessage(messages.noRedirectUrlError));
|
throw new Error(formatMessage(messages.noRedirectUrlError));
|
||||||
} catch (error) {
|
} catch {
|
||||||
data.$notify({
|
data.$notify({
|
||||||
group: "main",
|
group: "main",
|
||||||
title: formatMessage(commonMessages.errorNotificationTitle),
|
title: formatMessage(commonMessages.errorNotificationTitle),
|
||||||
|
|||||||
@ -145,7 +145,7 @@ if (route.query.flow) {
|
|||||||
await useAuth(auth.value.token);
|
await useAuth(auth.value.token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
success.value = false;
|
success.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -556,7 +556,7 @@ async function verifyTwoFactorCode() {
|
|||||||
backupCodes.value = res.backup_codes;
|
backupCodes.value = res.backup_codes;
|
||||||
twoFactorStep.value = 2;
|
twoFactorStep.value = 2;
|
||||||
await useAuth(auth.value.token);
|
await useAuth(auth.value.token);
|
||||||
} catch (err) {
|
} catch {
|
||||||
twoFactorIncorrect.value = true;
|
twoFactorIncorrect.value = true;
|
||||||
}
|
}
|
||||||
stopLoading();
|
stopLoading();
|
||||||
@ -573,7 +573,7 @@ async function removeTwoFactor() {
|
|||||||
});
|
});
|
||||||
manageTwoFactorModal.value.hide();
|
manageTwoFactorModal.value.hide();
|
||||||
await useAuth(auth.value.token);
|
await useAuth(auth.value.token);
|
||||||
} catch (err) {
|
} catch {
|
||||||
twoFactorIncorrect.value = true;
|
twoFactorIncorrect.value = true;
|
||||||
}
|
}
|
||||||
stopLoading();
|
stopLoading();
|
||||||
|
|||||||
@ -301,7 +301,7 @@ const canSubmit = computed(() => {
|
|||||||
const url = new URL(uri);
|
const url = new URL(uri);
|
||||||
return !!url;
|
return !!url;
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch {
|
||||||
allValid = false;
|
allValid = false;
|
||||||
}
|
}
|
||||||
return filledIn && (oneValid || allValid);
|
return filledIn && (oneValid || allValid);
|
||||||
|
|||||||
@ -226,7 +226,7 @@ async function changeLocale(value: string) {
|
|||||||
try {
|
try {
|
||||||
await vintl.changeLocale(value);
|
await vintl.changeLocale(value);
|
||||||
$failedLocale.value = undefined;
|
$failedLocale.value = undefined;
|
||||||
} catch (err) {
|
} catch {
|
||||||
$failedLocale.value = value;
|
$failedLocale.value = value;
|
||||||
} finally {
|
} finally {
|
||||||
$changingTo.value = undefined;
|
$changingTo.value = undefined;
|
||||||
|
|||||||
@ -1,89 +1,89 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Modrinth App Ad</title>
|
<title>Modrinth App Ad</title>
|
||||||
<script
|
<script
|
||||||
src="https://dn0qt3r0xannq.cloudfront.net/modrinth-7JfmkEIXEp/modrinth-longform/prebid-load.js"
|
src="https://dn0qt3r0xannq.cloudfront.net/modrinth-7JfmkEIXEp/modrinth-longform/prebid-load.js"
|
||||||
async
|
async
|
||||||
></script>
|
></script>
|
||||||
<link rel="preload" href="https://www.googletagservices.com/tag/js/gpt.js" as="script" />
|
<link rel="preload" href="https://www.googletagservices.com/tag/js/gpt.js" as="script" />
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
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", {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.data.modrinthOpenUrl && window.__TAURI_INTERNALS__) {
|
.ads-container {
|
||||||
window.__TAURI_INTERNALS__.invoke("plugin:ads|open_link", {
|
width: 100vw;
|
||||||
path: event.data.modrinthOpenUrl,
|
height: 100vh;
|
||||||
origin: event.origin,
|
overflow: hidden;
|
||||||
});
|
position: relative;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
window.addEventListener("mousewheel", (event) => {
|
#plus-link {
|
||||||
if (window.__TAURI_INTERNALS__) {
|
width: 100vw;
|
||||||
window.__TAURI_INTERNALS__.invoke("plugin:ads|scroll_ads_window", {
|
height: 100vh;
|
||||||
scroll: event.deltaY,
|
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",
|
||||||
|
},
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener("contextmenu", (event) => event.preventDefault());
|
window.addEventListener(
|
||||||
</script>
|
"message",
|
||||||
</body>
|
(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>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
import hljs from 'highlight.js/lib/core'
|
import hljs from 'highlight.js/lib/core'
|
||||||
// Scripting
|
// Scripting
|
||||||
import javascript from 'highlight.js/lib/languages/javascript'
|
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 lua from 'highlight.js/lib/languages/lua'
|
||||||
|
import python from 'highlight.js/lib/languages/python'
|
||||||
// Coding
|
// Coding
|
||||||
|
import groovy from 'highlight.js/lib/languages/groovy'
|
||||||
import java from 'highlight.js/lib/languages/java'
|
import java from 'highlight.js/lib/languages/java'
|
||||||
import kotlin from 'highlight.js/lib/languages/kotlin'
|
import kotlin from 'highlight.js/lib/languages/kotlin'
|
||||||
import scala from 'highlight.js/lib/languages/scala'
|
import scala from 'highlight.js/lib/languages/scala'
|
||||||
import groovy from 'highlight.js/lib/languages/groovy'
|
|
||||||
// Configs
|
// Configs
|
||||||
import gradle from 'highlight.js/lib/languages/gradle'
|
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 ini from 'highlight.js/lib/languages/ini'
|
||||||
import yaml from 'highlight.js/lib/languages/yaml'
|
import json from 'highlight.js/lib/languages/json'
|
||||||
import xml from 'highlight.js/lib/languages/xml'
|
|
||||||
import properties from 'highlight.js/lib/languages/properties'
|
import properties from 'highlight.js/lib/languages/properties'
|
||||||
import { md, configuredXss } from './parse'
|
import xml from 'highlight.js/lib/languages/xml'
|
||||||
|
import yaml from 'highlight.js/lib/languages/yaml'
|
||||||
|
import { configuredXss, md } from './parse'
|
||||||
|
|
||||||
/* REGISTRATION */
|
/* REGISTRATION */
|
||||||
// Scripting
|
// Scripting
|
||||||
@ -54,7 +54,7 @@ export const renderHighlightedString = (string) =>
|
|||||||
if (lang && hljs.getLanguage(lang)) {
|
if (lang && hljs.getLanguage(lang)) {
|
||||||
try {
|
try {
|
||||||
return hljs.highlight(str, { language: lang }).value
|
return hljs.highlight(str, { language: lang }).value
|
||||||
} catch (__) {
|
} catch {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
packages/utils/index.d.ts
vendored
2
packages/utils/index.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
const BASE62_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' as const
|
export const BASE62_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||||
type Base62Char = (typeof BASE62_CHARS)[number]
|
type Base62Char = (typeof BASE62_CHARS)[number]
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@ -116,7 +116,7 @@ export const configuredXss = new FilterXSS({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
return safeAttrValue(tag, name, url.toString(), cssFilter)
|
return safeAttrValue(tag, name, url.toString(), cssFilter)
|
||||||
} catch (err) {
|
} catch {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ export const md = (options = {}) => {
|
|||||||
if (allowedHostnames.includes(url.hostname)) {
|
if (allowedHostnames.includes(url.hostname)) {
|
||||||
return defaultLinkOpenRenderer(tokens, idx, options, env, self)
|
return defaultLinkOpenRenderer(tokens, idx, options, env, self)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user