Skip to content

Commit 30523b9

Browse files
committed
Merge #710: update dependencies and fix type errors
c884ccd update dependencies and fix type errors (Graeme Byrne) Pull request description: ## Summary This PR updates project dependencies to their latest compatible versions, ensuring that the project still builds and runs correctly. Care was taken to avoid versions that introduced breaking changes (e.g., Nuxt 3.17.4, which caused runtime errors). ## Changes - Updated `nuxt` and related dependencies to stable versions that do not break the project - Resolved type errors across the codebase introduced by dependency updates ACKs for top commit: josecelano: ACK c884ccd Tree-SHA512: e138e1cfc0e278d907b57dc053ca0b6f40ce58b1dd0aa0afe1f77469157e417e4ddd6abc7a17739a03a675cc925a19c8f631515ab801791892ef369f3d350a19
2 parents 6d7a621 + c884ccd commit 30523b9

32 files changed

+10754
-7819
lines changed

components/Markdown.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const sanitizedDescription = ref("");
2020
2121
const options = {
2222
headerIds: false,
23-
mangle: false
23+
mangle: false,
24+
async: true
2425
};
2526
2627
const source = computed(() => props.source);
@@ -33,12 +34,12 @@ onMounted(() => {
3334
sanitizeDescription();
3435
});
3536
36-
function convert_markdown_to_html (src: string) {
37-
return marked(src, options);
37+
async function convert_markdown_to_html (src: string): Promise<string> {
38+
return await marked(src, options);
3839
}
3940
4041
async function sanitizeDescription () {
41-
const html = convert_markdown_to_html(props.source);
42+
const html = await convert_markdown_to_html(props.source); // await here
4243
sanitizedDescription.value = await sanitize(html);
4344
}
4445
</script>

components/Pagination.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="flex flex-col items-center justify-end flex-1 gap-3 md:flex-row sm:justify-between">
44
<div class="flex items-center gap-3">
55
<div>
6-
<select :value="pageSize" class="px-2 py-1 bg-base-100" @change="(e) => updatePageSize(parseInt(e.target.value, 10))">
6+
<select :value="pageSize" class="px-2 py-1 bg-base-100" @change="(e) => updatePageSize(parseInt((e.target as HTMLSelectElement).value, 10))">
77
<option value="20">
88
20
99
</option>

components/authentication/AuthenticationForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function login () {
6262
navigateTo("/torrents", { replace: true });
6363
}
6464
})
65-
.catch((err) => {
65+
.catch((err: Error) => {
6666
notify({
6767
group: "error",
6868
title: "Error",

components/license/License.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<Markdown :source="file" class="prose-h1:text-center pt-2 pb-10 pb-5 px-40 max-w-none" />
3+
<Markdown :source="file" class="prose-h1:text-center pt-2 pb-5 px-40 max-w-none" />
44
</div>
55
</template>
66
<script setup lang="ts">

components/navigation/NavigationBar.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ const user = useUser();
8181
8282
const mobileCollapsed = ref(true);
8383
84+
// Define the submitSearch function
85+
function submitSearch () {
86+
// Add your search logic here
87+
}
8488
</script>
8589

8690
<style scoped>

components/registration/RegistrationForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function signup () {
108108
text: "Your account was registered!"
109109
}, 4000); // 4s
110110
})
111-
.catch((err) => {
111+
.catch((err: Error) => {
112112
notify({
113113
group: "error",
114114
title: "Error",

components/torrent/TorrentActionCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function deleteTorrent () {
194194
.then(() => {
195195
emit("deleted");
196196
})
197-
.catch((err) => {
197+
.catch((err: Error) => {
198198
notify({
199199
group: "error",
200200
title: "Error",

components/torrent/TorrentCreationDateTab.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ const props = defineProps({
4040
}
4141
});
4242
43-
const formattedDateFromTimestamp = formatTimestamp(props.torrent.creation_date);
43+
const formattedDateFromTimestamp = (() => {
44+
const result = formatTimestamp(props.torrent.creation_date);
45+
return result instanceof Error ? "Invalid date" : result;
46+
})();
4447
4548
</script>
4649

components/torrent/TorrentDetails.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ function getTorrentFromApi (infoHash: string) {
8080
loadingTorrent.value = true;
8181
8282
rest.torrent.getTorrentInfo(infoHash)
83-
.then((data) => {
83+
.then((data: TorrentResponse) => {
8484
torrent.value = data;
8585
title.value = data.title;
8686
})
87-
.catch((err) => {
87+
.catch((err: Error) => {
8888
loadingTorrent.value = false;
8989
notify({
9090
group: "error",

components/torrent/TorrentTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="flex flex-col w-full overflow-hidden rounded-lg border-base-content/20 rounded-2xl grow">
2+
<div class="flex flex-col w-full overflow-hidden border-base-content/20 rounded-2xl grow">
33
<div class="flex flex-col overflow-x-auto whitespace-nowrap">
44
<table class="text-center table-auto bg-base-200">
55
<thead>

components/user/ChangePasswordForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function changePassword (username: string) {
100100
text: "Your password was changed!"
101101
}, 4000); // 4s
102102
})
103-
.catch((err) => {
103+
.catch((err: Error) => {
104104
notify({
105105
group: "error",
106106
title: "Error",

components/user/UserTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="flex flex-col w-full overflow-hidden rounded-lg border-base-content/20 rounded-2xl grow">
2+
<div class="flex flex-col w-full overflow-hidden border-base-content/20 rounded-2xl grow">
33
<div class="flex flex-col overflow-x-auto whitespace-nowrap">
44
<table class="text-center table-auto bg-base-200 ">
55
<thead>

composables/states.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { useRuntimeConfig, useState } from "#imports";
66
export const useRestApi = () => useState<Rest>("rest-api", () => new Rest(useRuntimeConfig().public.apiBase));
77
export const useCategories = () => useState<Array<Category>>("categories", () => new Array<Category>());
88
export const useTags = () => useState<Array<TorrentTag>>("tags", () => new Array<TorrentTag>());
9-
export const useSettings = () => useState<PublicSettings>("public-settings", () => null);
10-
export const useUser = () => useState<TokenResponse>("user", () => null);
9+
export const useSettings = (): Ref<PublicSettings | null> => useState<PublicSettings>("public-settings", (): PublicSettings | null => null);
10+
export const useUser = (): Ref<TokenResponse | null> => useState<TokenResponse>("user", (): TokenResponse | null => null);
1111

1212
export function getSettings () {
1313
useRestApi().value.settings.getPublicSettings()
14-
.then((publicSettings) => {
14+
.then((publicSettings: PublicSettings) => {
1515
useSettings().value = publicSettings;
1616
})
17-
.catch((err) => {
17+
.catch((err: Error) => {
1818
notify({
1919
group: "error",
2020
title: "Error",
@@ -25,10 +25,10 @@ export function getSettings () {
2525

2626
export function getCategories () {
2727
useRestApi().value.category.getCategories()
28-
.then((res) => {
28+
.then((res: Category[]) => {
2929
useCategories().value = res;
3030
})
31-
.catch((err) => {
31+
.catch((err: Error) => {
3232
notify({
3333
group: "error",
3434
title: "Error",
@@ -39,10 +39,10 @@ export function getCategories () {
3939

4040
export function getTags () {
4141
useRestApi().value.tag.getTags()
42-
.then((res) => {
42+
.then((res: Category[]) => {
4343
useTags().value = res;
4444
})
45-
.catch((err) => {
45+
.catch((err: Error) => {
4646
notify({
4747
group: "error",
4848
title: "Error",
@@ -57,11 +57,11 @@ export async function loginUser (login: string, password: string): Promise<boole
5757
login,
5858
password
5959
})
60-
.then((user) => {
60+
.then((user: TokenResponse) => {
6161
useUser().value = user;
6262
authenticated = true;
6363
})
64-
.catch((err) => {
64+
.catch((err: Error) => {
6565
notify({
6666
group: "error",
6767
title: "Error",
@@ -83,10 +83,10 @@ export async function getUser () {
8383
}
8484

8585
return await useRestApi().value.user.renewToken()
86-
.then((user) => {
86+
.then((user: TokenResponse) => {
8787
useUser().value = user;
8888
})
89-
.catch((err) => {
89+
.catch((err: Error) => {
9090
notify({
9191
group: "error",
9292
title: "Error",

cypress/e2e/contexts/category/specs/add.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
1+
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
22
import { random_category_name } from "../fixtures";
33

44
describe("The admin user", () => {

cypress/e2e/contexts/category/specs/delete.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
1+
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
22
import { random_category_name } from "../fixtures";
33

44
describe("The admin user", () => {

cypress/e2e/contexts/category/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Custom tasks for category context
22

3-
import { DatabaseConfig, DatabaseQuery, runDatabaseQuery } from "../../common/database";
3+
import { type DatabaseConfig, type DatabaseQuery, runDatabaseQuery } from "../../common/database";
44

55
// Task to delete a category
66
export const deleteCategory = async (name: string, db_config: DatabaseConfig): Promise<string> => {

cypress/e2e/contexts/tag/specs/add.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
1+
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
22
import { randomTagName } from "../random_data";
33

44
describe("The admin user", () => {

cypress/e2e/contexts/tag/specs/delete.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RegistrationForm, random_user_registration_data } from "../../user/registration";
1+
import { type RegistrationForm, random_user_registration_data } from "../../user/registration";
22
import { randomTagName } from "../random_data";
33

44
describe("The admin user", () => {

cypress/e2e/contexts/tag/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Custom tasks for tag context
22

3-
import { DatabaseConfig, DatabaseQuery, runDatabaseQuery } from "../../common/database";
3+
import { type DatabaseConfig, type DatabaseQuery, runDatabaseQuery } from "../../common/database";
44

55
// Task to delete a tag
66
export const deleteTags = async (db_config: DatabaseConfig): Promise<any> => {

nuxt.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export default defineNuxtConfig({
1515
"@nuxtjs/color-mode"
1616
],
1717

18+
build: {
19+
transpile: ["notiwind-ts"]
20+
},
21+
1822
colorMode: {
1923
preference: "dark", // default value of $colorMode.preference
2024
fallback: "dark", // fallback value if not system preference found

0 commit comments

Comments
 (0)