Add ablum feature to web (#352)

* Added album page

* Refactor sidebar

* Added album assets count info

* Added album viewer page

* Refactor album sorting

* Fixed incorrectly showing selected asset in album selection

* Improve fetching speed with prefetch

* Refactor to use ImmichThubmnail component for all

* Update to the latest version of Svelte

* Implement fixed app bar in album viewer

* Added shared user avatar

* Correctly get all owned albums, including shared
This commit is contained in:
Alex
2022-07-15 23:18:17 -05:00
committed by GitHub
parent 1887b5a860
commit 7134f93eb8
62 changed files with 2572 additions and 991 deletions

View File

@@ -57,7 +57,7 @@
</script>
<svelte:head>
<title>Immich - Change Password</title>
<title>Change Password - Immich</title>
</svelte:head>
<section class="h-screen w-screen flex place-items-center place-content-center">

View File

@@ -1,13 +1,13 @@
import type { RequestHandler } from '@sveltejs/kit';
import { api } from '@api';
export const post: RequestHandler = async ({ request, locals }) => {
export const POST: RequestHandler = async ({ request, locals }) => {
if (!locals.user) {
return {
status: 401,
body: {
error: 'Unauthorized',
},
error: 'Unauthorized'
}
};
}
@@ -17,22 +17,22 @@ export const post: RequestHandler = async ({ request, locals }) => {
const { status } = await api.userApi.updateUser({
id: locals.user.id,
password: String(password),
shouldChangePassword: false,
shouldChangePassword: false
});
if (status === 200) {
return {
status: 200,
body: {
success: 'Succesfully change password',
},
success: 'Succesfully change password'
}
};
} else {
return {
status: 400,
body: {
error: 'Error change password',
},
error: 'Error change password'
}
};
}
};

View File

@@ -10,7 +10,7 @@
</script>
<svelte:head>
<title>Immich - Login</title>
<title>Login - Immich</title>
</svelte:head>
<section class="h-screen w-screen flex place-items-center place-content-center">

View File

@@ -2,7 +2,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import * as cookie from 'cookie';
import { api } from '@api';
export const post: RequestHandler = async ({ request }) => {
export const POST: RequestHandler = async ({ request }) => {
const form = await request.formData();
const email = form.get('email');
@@ -11,7 +11,7 @@ export const post: RequestHandler = async ({ request }) => {
try {
const { data: authUser } = await api.authenticationApi.login({
email: String(email),
password: String(password),
password: String(password)
});
return {
@@ -24,9 +24,9 @@ export const post: RequestHandler = async ({ request }) => {
lastName: authUser.lastName,
isAdmin: authUser.isAdmin,
email: authUser.userEmail,
shouldChangePassword: authUser.shouldChangePassword,
shouldChangePassword: authUser.shouldChangePassword
},
success: 'success',
success: 'success'
},
headers: {
'Set-Cookie': cookie.serialize(
@@ -37,23 +37,23 @@ export const post: RequestHandler = async ({ request }) => {
firstName: authUser.firstName,
lastName: authUser.lastName,
isAdmin: authUser.isAdmin,
email: authUser.userEmail,
email: authUser.userEmail
}),
{
path: '/',
httpOnly: true,
sameSite: 'strict',
maxAge: 60 * 60 * 24 * 30,
},
),
},
maxAge: 60 * 60 * 24 * 30
}
)
}
};
} catch (error) {
return {
status: 400,
body: {
error: 'Incorrect email or password',
},
error: 'Incorrect email or password'
}
};
}
};

View File

@@ -1,12 +1,12 @@
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async () => {
export const POST: RequestHandler = async () => {
return {
headers: {
'Set-Cookie': 'session=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT',
'Set-Cookie': 'session=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT'
},
body: {
ok: true,
},
ok: true
}
};
};

View File

@@ -29,7 +29,7 @@
</script>
<svelte:head>
<title>Immich - Admin Registration</title>
<title>Admin Registration - Immich</title>
</svelte:head>
<section class="h-screen w-screen flex place-items-center place-content-center">

View File

@@ -1,7 +1,7 @@
import type { RequestHandler } from '@sveltejs/kit';
import { api } from '@api';
export const post: RequestHandler = async ({ request }) => {
export const POST: RequestHandler = async ({ request }) => {
const form = await request.formData();
const email = form.get('email');
@@ -13,22 +13,22 @@ export const post: RequestHandler = async ({ request }) => {
email: String(email),
password: String(password),
firstName: String(firstName),
lastName: String(lastName),
lastName: String(lastName)
});
if (status === 201) {
return {
status: 201,
body: {
success: 'Succesfully create admin account',
},
success: 'Succesfully create admin account'
}
};
} else {
return {
status: 400,
body: {
error: 'Error create admin account',
},
error: 'Error create admin account'
}
};
}
};