Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ tailwind.config.cjs
tsconfig.json
.pnpm-store
src/i18n
.devcontainer/devcontainer.json
.devcontainer/devcontainer.json
.vscode/
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// cSpell:disable (don't complain about the words we listed here)
"flagWords": ["hte"]
"flagWords": ["hte", "comunity"]
}
81 changes: 33 additions & 48 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import typescriptParser from '@typescript-eslint/parser';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import sveltePlugin from "eslint-plugin-svelte";
import svelteParser from "svelte-eslint-parser";
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';


const rules = {
'array-callback-return': 'error',
Expand All @@ -26,65 +27,49 @@ const rules = {
'no-shadow': 'error',
'no-use-before-define': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
varsIgnorePattern: '^_',
argsIgnorePattern: '^_'
}]
'@typescript-eslint/no-unused-vars': [
'warn', {
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
}
],
// TODO: This was disabled to due the explicit side-effect style in svelte (`$: ...`). Can be re-enabled with runes
'@typescript-eslint/no-unused-expressions': 'off',
'svelte/no-at-html-tags': 'warn',
};

export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
ignores: [
".svelte-kit/**/*",
"node_modules/**/*",
"dist/**/*",
"build/**/*",
"src/i18n/**/*"
"src/i18n/**/*",
"postcss.config.cjs",
],
},

{
files: ["**/*.ts"],
ignores: [
"custom-theme.ts",
"src/service-worker.ts",
"tailwind.config.ts"
],
languageOptions: {
parser: typescriptParser,
parserOptions: {
project: "./tsconfig.json",
extraFileExtensions: [".svelte"],
},
},
plugins: {
"@typescript-eslint": typescriptPlugin,
},
rules: {
...typescriptPlugin.configs.recommended.rules,
...rules
},
},

{
files: ["**/*.svelte"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: typescriptParser,
project: "./tsconfig.json",
extraFileExtensions: [".svelte"],
parser: ts.parser,
},
},
plugins: {
svelte: sveltePlugin,
"@typescript-eslint": typescriptPlugin,
},
rules: {
...typescriptPlugin.configs.recommended.rules,
...sveltePlugin.configs.recommended.rules,
...rules,
'svelte/no-at-html-tags': 'off'
},
},
];
{
rules
}
];
22 changes: 14 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"format": "prettier --write . && eslint . --fix",
"translations": "bash ./download_translations.sh"
},
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
}
},
"dependencies": {
"@felte/core": "^1.4.3",
"@felte/reporter-svelte": "^1.1.11",
Expand All @@ -46,15 +51,16 @@
"prismjs": "^1.29.0",
"semver": "^7.6.3",
"socket.io-client": "^4.7.5",
"tslib": "^2.6.3",
"thumbhash": "^0.1.1",
"tslib": "^2.6.3",
"wonka": "^6.3.4",
"zod": "^3.23.8"
},
"devDependencies": {
"@cfworker/json-schema": "^1.12.8",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@commitlint/config-conventional": "^19.3.0",
"@commitlint/cz-commitlint": "^19.5.0",
"@eslint/eslintrc": "^3.1.0",
"@graphql-codegen/add": "^5.0.3",
"@graphql-codegen/cli": "^5.0.2",
Expand All @@ -80,21 +86,20 @@
"@types/node": "^20.14.12",
"@types/prismjs": "^1.26.4",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"autoprefixer": "^10.4.19",
"chokidar-cli": "^3.0.0",
"concurrently": "^8.2.2",
"cookieconsent": "^3.1.1",
"cross-env": "^7.0.3",
"cssnano": "^7.0.4",
"cz-conventional-changelog": "^3.3.0",
"cz": "^1.8.2",
"dotenv-flow": "^4.1.0",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.43.0",
"eslint": "^9.7",
"eslint-config-prettier": "^9.1",
"eslint-plugin-svelte": "^2.43",
"graphql-tag": "^2.12.6",
"husky": "^9.1.1",
"inquirer": "9",
"postcss": "^8.4.40",
"postcss-import-url": "^7.2.0",
"postcss-load-config": "^6.0.1",
Expand All @@ -110,6 +115,7 @@
"svelte-preprocess": "^6.0.2",
"tailwindcss": "^3.4.6",
"typescript": "^5.5.4",
"typescript-eslint": "^8.13.0",
"urql": "^4.1.0",
"vite": "^5.3.5",
"vite-plugin-tailwind-purgecss": "^0.3.3"
Expand Down
9 changes: 9 additions & 0 deletions src/gql/mods/versions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ query GetModVersions($mod: ModID!, $limit: Int!, $offset: Int!) {
hash
size
}
virustotal_results {
created_at
file_name
hash
id
safe
updated_at
version_id
}
}
}
}
9 changes: 9 additions & 0 deletions src/gql/versions/mod_version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,14 @@ query GetModVersion($version: VersionID!) {
optional
condition
}
virustotal_results {
created_at
file_name
hash
id
safe
updated_at
version_id
}
}
}
28 changes: 12 additions & 16 deletions src/lib/components/auth/LoginDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@

if (browser) {
let first = true;

userToken.subscribe((token) => {
if (token) {
const oneMonth = new Date(new Date().getTime() + 30 * 24 * 60 * 60 * 1000);
cookie.set('token', token, {
domain: window.location.hostname,
expires: oneMonth
});
} else if (!first) {
if (!token && !first) {
// User is logged in but token has been set to null (logging out)
client
.mutation(LogoutDocument, undefined, {
requestPolicy: 'network-only'
Expand All @@ -41,23 +37,23 @@
.then(() => {
cookie.remove('token');
});
}

first = false;

if (token) {
$user = null;
} else if (token) {
const oneMonth = new Date(new Date().getTime() + 30 * 24 * 60 * 60 * 1000);
cookie.set('token', token, {
expires: oneMonth
});
first = false;
client
.query(GetMeDocument, {}, { requestPolicy: 'network-only' })
.toPromise()
.then((response) => {
if (response.error) {
console.error(response.error.message);
} else if (response.data) {
user.set(response.data.getMe);
$user = response.data.getMe;
}
});
} else {
user.set(null);
}
});
}
Expand Down Expand Up @@ -116,7 +112,7 @@
autohide: false
});
} else {
userToken.set(result.data.session.token);
$userToken = result.data.session.token;
modalStore.close();
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/general/FicsitCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<div class="logo max-h-full min-h-full min-w-full max-w-full bg-neutral-500" />
{:else}
<img
class="logo absolute max-h-full min-h-full min-w-full max-w-full transition-opacity delay-100 duration-200 ease-linear"
class="logo absolute max-h-full min-h-full min-w-full max-w-full object-contain transition-opacity delay-100 duration-200 ease-linear"
class:invisible={!imageLoaded}
class:opacity-0={!imageLoaded}
src={renderedLogo}
Expand Down
37 changes: 32 additions & 5 deletions src/lib/components/general/TranslationDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,45 @@

export const { t } = getTranslate();

const languages = {
type language = {
name: string;
flag: string;
style?: string;
};

const defaultFlagTextStyle = 'text-white';

// cspell:disable
const languages: Record<string, language> = {
en: {
name: 'English',
flag: '🇺🇳'
},
de: {
name: 'Deutsch',
flag: '🇩🇪'
flag: '🇩🇪',
style: 'text-black' // Bug in something? text color affects the top stripe of the DE flag
},
es: {
name: 'Español',
flag: '🇪🇸'
},
fr: {
name: 'Français',
flag: '🇫🇷'
},
hu: {
name: 'Magyar',
flag: '🇭🇺'
},
it: {
name: 'Italiano',
flag: '🇮🇹'
},
ko: {
name: '한국어',
flag: '🇰🇷'
},
lv: {
name: 'Latviešu',
flag: '🇱🇻'
Expand All @@ -37,6 +59,10 @@
name: 'Nederlands',
flag: '🇳🇱'
},
'pt-BR': {
name: 'Português (Brasil)',
flag: '🇧🇷'
},
pl: {
name: 'Polski',
flag: '🇵🇱'
Expand All @@ -54,6 +80,7 @@
flag: '🇹🇼'
}
} as const;
// cspell:enable

const lang = writable<string>((browser && localStorage.getItem('language')) || $tolgee.getLanguage());
lang.subscribe((l) => {
Expand All @@ -73,17 +100,17 @@

<button class="variant-ghost-primary btn btn-sm grid grid-flow-col" use:popup={languageMenuBox}>
<span>{languages[$lang].name}</span>
<span class="text-xl">{languages[$lang].flag}</span>
<span class={`text-xl ${languages[$lang]?.style ?? defaultFlagTextStyle}`}>{languages[$lang].flag}</span>
</button>

<div class="card w-48 py-2 shadow-xl" data-popup="languageMenuBox">
<div class="card w-56 overflow-y-auto scroll-smooth py-2 shadow-xl" data-popup="languageMenuBox">
<nav class="list-nav">
<ul>
{#each Object.entries(languages) as [k, v]}
<li class:bg-primary-active-token={$lang === k}>
<button class="w-full" on:click={() => lang.set(k)}>
<span>{v.name}</span>
<span class="text-xl text-white">{v.flag}</span>
<span class="text-xl {v?.style ?? defaultFlagTextStyle}">{v.flag}</span>
</button>
</li>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<span style="padding: 2px; white-space:normal">
{#if compatibility?.EA?.note}
{#await markdown(compatibility.EA.note) then rendered}
{@html rendered}
{@html rendered} <!-- eslint-disable-line svelte/no-at-html-tags -->
{/await}
{:else}
{noNotesText}
Expand All @@ -72,7 +72,7 @@
<span style="padding: 2px; white-space:normal">
{#if compatibility?.EXP?.note}
{#await markdown(compatibility.EXP.note) then rendered}
{@html rendered}
{@html rendered} <!-- eslint-disable-line svelte/no-at-html-tags -->
{/await}
{:else}
{noNotesText}
Expand Down
Loading