Skip to content

update dependencies and fix type errors #710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
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
9 changes: 5 additions & 4 deletions components/Markdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const sanitizedDescription = ref("");

const options = {
headerIds: false,
mangle: false
mangle: false,
async: true
};

const source = computed(() => props.source);
Expand All @@ -33,12 +34,12 @@ onMounted(() => {
sanitizeDescription();
});

function convert_markdown_to_html (src: string) {
return marked(src, options);
async function convert_markdown_to_html (src: string): Promise<string> {
return await marked(src, options);
}

async function sanitizeDescription () {
const html = convert_markdown_to_html(props.source);
const html = await convert_markdown_to_html(props.source); // await here
sanitizedDescription.value = await sanitize(html);
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion components/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="flex flex-col items-center justify-end flex-1 gap-3 md:flex-row sm:justify-between">
<div class="flex items-center gap-3">
<div>
<select :value="pageSize" class="px-2 py-1 bg-base-100" @change="(e) => updatePageSize(parseInt(e.target.value, 10))">
<select :value="pageSize" class="px-2 py-1 bg-base-100" @change="(e) => updatePageSize(parseInt((e.target as HTMLSelectElement).value, 10))">
<option value="20">
20
</option>
Expand Down
2 changes: 1 addition & 1 deletion components/authentication/AuthenticationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function login () {
navigateTo("/torrents", { replace: true });
}
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand Down
2 changes: 1 addition & 1 deletion components/license/License.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<Markdown :source="file" class="prose-h1:text-center pt-2 pb-10 pb-5 px-40 max-w-none" />
<Markdown :source="file" class="prose-h1:text-center pt-2 pb-5 px-40 max-w-none" />
</div>
</template>
<script setup lang="ts">
Expand Down
4 changes: 4 additions & 0 deletions components/navigation/NavigationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const user = useUser();

const mobileCollapsed = ref(true);

// Define the submitSearch function
function submitSearch () {
// Add your search logic here
}
</script>

<style scoped>
Expand Down
2 changes: 1 addition & 1 deletion components/registration/RegistrationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function signup () {
text: "Your account was registered!"
}, 4000); // 4s
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand Down
2 changes: 1 addition & 1 deletion components/torrent/TorrentActionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function deleteTorrent () {
.then(() => {
emit("deleted");
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand Down
5 changes: 4 additions & 1 deletion components/torrent/TorrentCreationDateTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const props = defineProps({
}
});

const formattedDateFromTimestamp = formatTimestamp(props.torrent.creation_date);
const formattedDateFromTimestamp = (() => {
const result = formatTimestamp(props.torrent.creation_date);
return result instanceof Error ? "Invalid date" : result;
})();

</script>

Expand Down
4 changes: 2 additions & 2 deletions components/torrent/TorrentDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ function getTorrentFromApi (infoHash: string) {
loadingTorrent.value = true;

rest.torrent.getTorrentInfo(infoHash)
.then((data) => {
.then((data: TorrentResponse) => {
torrent.value = data;
title.value = data.title;
})
.catch((err) => {
.catch((err: Error) => {
loadingTorrent.value = false;
notify({
group: "error",
Expand Down
2 changes: 1 addition & 1 deletion components/torrent/TorrentTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="flex flex-col w-full overflow-hidden rounded-lg border-base-content/20 rounded-2xl grow">
<div class="flex flex-col w-full overflow-hidden border-base-content/20 rounded-2xl grow">
<div class="flex flex-col overflow-x-auto whitespace-nowrap">
<table class="text-center table-auto bg-base-200">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion components/user/ChangePasswordForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function changePassword (username: string) {
text: "Your password was changed!"
}, 4000); // 4s
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand Down
2 changes: 1 addition & 1 deletion components/user/UserTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="flex flex-col w-full overflow-hidden rounded-lg border-base-content/20 rounded-2xl grow">
<div class="flex flex-col w-full overflow-hidden border-base-content/20 rounded-2xl grow">
<div class="flex flex-col overflow-x-auto whitespace-nowrap">
<table class="text-center table-auto bg-base-200 ">
<thead>
Expand Down
24 changes: 12 additions & 12 deletions composables/states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { useRuntimeConfig, useState } from "#imports";
export const useRestApi = () => useState<Rest>("rest-api", () => new Rest(useRuntimeConfig().public.apiBase));
export const useCategories = () => useState<Array<Category>>("categories", () => new Array<Category>());
export const useTags = () => useState<Array<TorrentTag>>("tags", () => new Array<TorrentTag>());
export const useSettings = () => useState<PublicSettings>("public-settings", () => null);
export const useUser = () => useState<TokenResponse>("user", () => null);
export const useSettings = (): Ref<PublicSettings | null> => useState<PublicSettings>("public-settings", (): PublicSettings | null => null);
export const useUser = (): Ref<TokenResponse | null> => useState<TokenResponse>("user", (): TokenResponse | null => null);

export function getSettings () {
useRestApi().value.settings.getPublicSettings()
.then((publicSettings) => {
.then((publicSettings: PublicSettings) => {
useSettings().value = publicSettings;
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand All @@ -25,10 +25,10 @@ export function getSettings () {

export function getCategories () {
useRestApi().value.category.getCategories()
.then((res) => {
.then((res: Category[]) => {
useCategories().value = res;
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand All @@ -39,10 +39,10 @@ export function getCategories () {

export function getTags () {
useRestApi().value.tag.getTags()
.then((res) => {
.then((res: Category[]) => {
useTags().value = res;
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand All @@ -57,11 +57,11 @@ export async function loginUser (login: string, password: string): Promise<boole
login,
password
})
.then((user) => {
.then((user: TokenResponse) => {
useUser().value = user;
authenticated = true;
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand All @@ -83,10 +83,10 @@ export async function getUser () {
}

return await useRestApi().value.user.renewToken()
.then((user) => {
.then((user: TokenResponse) => {
useUser().value = user;
})
.catch((err) => {
.catch((err: Error) => {
notify({
group: "error",
title: "Error",
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/contexts/category/specs/add.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
import { random_category_name } from "../fixtures";

describe("The admin user", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/contexts/category/specs/delete.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
import { random_category_name } from "../fixtures";

describe("The admin user", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/contexts/category/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Custom tasks for category context

import { DatabaseConfig, DatabaseQuery, runDatabaseQuery } from "../../common/database";
import { type DatabaseConfig, type DatabaseQuery, runDatabaseQuery } from "../../common/database";

// Task to delete a category
export const deleteCategory = async (name: string, db_config: DatabaseConfig): Promise<string> => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/contexts/tag/specs/add.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
import { randomTagName } from "../random_data";

describe("The admin user", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/contexts/tag/specs/delete.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
import { randomTagName } from "../random_data";

describe("The admin user", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/contexts/tag/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Custom tasks for tag context

import { DatabaseConfig, DatabaseQuery, runDatabaseQuery } from "../../common/database";
import { type DatabaseConfig, type DatabaseQuery, runDatabaseQuery } from "../../common/database";

// Task to delete a tag
export const deleteTags = async (db_config: DatabaseConfig): Promise<any> => {
Expand Down
4 changes: 4 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default defineNuxtConfig({
"@nuxtjs/color-mode"
],

build: {
transpile: ["notiwind-ts"]
},

colorMode: {
preference: "dark", // default value of $colorMode.preference
fallback: "dark", // fallback value if not system preference found
Expand Down
Loading