Skip to content
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

staging #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
7,516 changes: 3,002 additions & 4,514 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,44 @@
"dependencies": {
"@libsql/client": "^0.3.6",
"@lucia-auth/adapter-sqlite": "^2.0.1",
"@lucia-auth/oauth": "^3.5.0",
"@lucia-auth/oauth": "^3.5.3",
"drizzle-orm": "^0.29.1",
"lucia": "^2.7.4",
"open-props": "1.6.16",
"open-props": "1.6.18",
"pretty-ms": "^8.0.0"
},
"devDependencies": {
"@melt-ui/pp": "0.1.4",
"@melt-ui/svelte": "0.65.0",
"@playwright/test": "^1.40.1",
"@sveltejs/adapter-auto": "^2.1.1",
"@sveltejs/adapter-netlify": "2.0.8",
"@playwright/test": "^1.41.2",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-netlify": "^3.0.0",
"@sveltejs/enhanced-img": "0.1.5",
"@sveltejs/kit": "^1.27.7",
"@types/node": "20.10.4",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"autoprefixer": "10.4.16",
"dotenv": "^16.3.1",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/node": "20.11.17",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"autoprefixer": "10.4.17",
"dotenv": "^16.4.2",
"drizzle-kit": "^0.20.6",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"lefthook": "1.5.5",
"lefthook": "1.6.1",
"npm-run-all": "4.1.5",
"postcss": "8.4.32",
"postcss": "8.4.35",
"postcss-jit-props": "1.0.14",
"prettier": "^3.1.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"svelte": "^4.2.10",
"svelte-check": "^3.6.4",
"svelte-sequential-preprocessor": "2.0.1",
"tslib": "^2.6.2",
"tsx": "^4.6.2",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"vite": "^4.5.0",
"vitest": "^1.0.2"
"vite": "^5.0.0",
"vitest": "^1.2.2"
},
"private": true,
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const handle: Handle = async ({ event, resolve }) => {
event.url.pathname === "/app" ||
event.url.pathname === "/"
) {
throw redirect(303, "/app/playlists");
redirect(303, "/app/playlists");
}
} else {
if (isProtectedRoute(event.url.pathname)) {
throw redirect(303, "/");
redirect(303, "/");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export const actions: Actions = {
locals.auth.setSession(null);

// redirect to login page
throw redirect(302, "/");
redirect(302, "/");
},
};
5 changes: 5 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export const PAGE_FIELDS = "offset,limit,total,previous,next";

export const DEFAULT_PARAMS = {
offset: 0,
limit: 20,
};
4 changes: 2 additions & 2 deletions src/routes/api/albums/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { json } from "@sveltejs/kit";
import { queryApiFn } from "$lib/server/api";
import { mergeParams } from "$lib/utils/data";
import { getEndpoint } from "$lib/utils/spotify.js";
import { DEFAULT_PARAMS } from "$lib/constants.js";

const getDefaultParams = () => ({
...DEFAULT_PARAMS,
market: "from_token",
limit: 50,
offset: 0,
});

export async function GET({ locals, url }) {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/artists/top/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { json } from "@sveltejs/kit";
import { mergeParams } from "$lib/utils/data.js";
import { getEndpoint } from "$lib/utils/spotify.js";
import { queryApiFn } from "$lib/server/api";
import { DEFAULT_PARAMS } from "$lib/constants.js";

const getDefaultParams = () => ({
...DEFAULT_PARAMS,
time_range: "short_term",
limit: 25,
offset: 0,
});

export async function GET({ locals, url }) {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/playlists/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { json } from "@sveltejs/kit";
import { queryApiFn } from "$lib/server/api";
import { mergeParams } from "$lib/utils/data";
import { getEndpoint } from "$lib/utils/spotify.js";
import { DEFAULT_PARAMS } from "$lib/constants.js";

const getDefaultParams = () => ({
limit: 50,
offset: 0,
...DEFAULT_PARAMS,
});

export async function GET({ locals, url }) {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/playlists/[id]/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { json } from "@sveltejs/kit";
import { queryApiFn } from "$lib/server/api.js";
import { mergeParams } from "$lib/utils/data.js";
import { getEndpoint } from "$lib/utils/spotify.js";
import { DEFAULT_PARAMS } from "$lib/constants.js";

const getDefaultParams = () => ({
...DEFAULT_PARAMS,
fields: `id,name,description,images`,
market: "from_token",
limit: 50,
offset: 0,
});

export async function GET({ locals, params, fetch, url }) {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/playlists/[id]/tracks/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { queryApiFn } from "$lib/server/api";
import { mergeParams } from "$lib/utils/data.js";
import { getEndpoint } from "$lib/utils/spotify.js";
import { injectAudio } from "$lib/utils/track.js";
import { DEFAULT_PARAMS } from "$lib/constants.js";

const trackFields = [
"id",
Expand All @@ -20,8 +21,7 @@ const trackFields = [
].join(",");

const getDefaultParams = () => ({
offset: 0,
limit: 50,
...DEFAULT_PARAMS,
market: "from_token",
fields: `limit,offset,total,next,previous,items(track(${trackFields}))`,
});
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/tracks/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { queryApiFn } from "$lib/server/api.js";
import { injectAudio } from "$lib/utils/track.js";
import { mergeParams } from "$lib/utils/data.js";
import { getEndpoint } from "$lib/utils/spotify.js";
import { DEFAULT_PARAMS } from "$lib/constants.js";

const getDefaultParams = () => ({
...DEFAULT_PARAMS,
time_range: "long_term",
limit: 50,
offset: 0,
});

export async function GET({ locals, url }) {
Expand Down
3 changes: 2 additions & 1 deletion src/routes/app/albums/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import type { LayoutLoad } from "./$types";

export const load: LayoutLoad = async ({ fetch }) => {
const res = await fetch("/api/albums?offset=0");
const albums: Page<SavedAlbum> = await res.json();

return {
albums: res.json() as Promise<Page<SavedAlbum>>,
albums,
};
};
3 changes: 2 additions & 1 deletion src/routes/app/albums/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import type { PageLoad } from "./$types";

export const load: PageLoad = async ({ fetch, params }) => {
const res = await fetch(`/api/albums/${params.id}`);
const album: Album = await res.json();

return {
album: res.json() as Promise<Album>,
album,
};
};
3 changes: 2 additions & 1 deletion src/routes/app/playlists/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import type { Page, Playlist, TrackItem } from "$lib/typings/spotify";

export const load = async ({ fetch }) => {
const res = await fetch("/api/playlists?offset=0");
const playlists: Page<Playlist<TrackItem>> = await res.json();

return {
playlists: res.json() as Promise<Page<Playlist<TrackItem>>>,
playlists,
};
};
2 changes: 0 additions & 2 deletions src/routes/app/playlists/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { Page, Playlist, TrackItem } from "$lib/typings/spotify";
import type { AudioTrack } from "$lib/typings/app";
import type { PageLoad } from "./$types";

// export { actions } from "$lib/actions";

export const load: PageLoad = async ({ params, fetch }) => {
const res = await fetch(`/api/playlists/${params.id}`);

Expand Down
3 changes: 2 additions & 1 deletion src/routes/app/tracks/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import type { Page, Track } from "$lib/typings/spotify";

export const load = async ({ fetch }) => {
const res = await fetch("/api/tracks?offset=0");
const tracks: Page<Track> = await res.json();

return {
tracks: res.json() as Promise<Page<Track>>,
tracks,
};
};
Empty file added static/favicon.ico
Empty file.
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sequence from "svelte-sequential-preprocessor";
import adapter from "@sveltejs/adapter-netlify";
import { vitePreprocess } from "@sveltejs/kit/vite";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import { preprocessMeltUI } from "@melt-ui/pp";

/** @type {import('@sveltejs/kit').Config}*/
Expand Down