mirror of
https://github.com/immich-app/immich.git
synced 2025-06-16 21:38:28 +02:00
Merge branch 'main' of github.com:immich-app/immich into user-pincode
This commit is contained in:
commit
fa22c345be
41 changed files with 807 additions and 587 deletions
.github/workflows
i18n
mobile/openapi
open-api/typescript-sdk/src
server/src
web/src
lib
components
album-page
asset-viewer
forms
map-page
shared-components
user-settings-page
managers
modals
routes
(user)/map/[[photos=photos]]/[[assetId=id]]
admin
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
|
@ -593,8 +593,8 @@ jobs:
|
||||||
echo "Changed files: ${CHANGED_FILES}"
|
echo "Changed files: ${CHANGED_FILES}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
generated-typeorm-migrations-up-to-date:
|
sql-schema-up-to-date:
|
||||||
name: TypeORM Checks
|
name: SQL Schema Checks
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -641,7 +641,7 @@ jobs:
|
||||||
|
|
||||||
- name: Generate new migrations
|
- name: Generate new migrations
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: npm run migrations:generate TestMigration
|
run: npm run migrations:generate src/TestMigration
|
||||||
|
|
||||||
- name: Find file changes
|
- name: Find file changes
|
||||||
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20
|
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
"unable_to_create_pincode": "Unable to create PIN code",
|
"unable_to_create_pincode": "Unable to create PIN code",
|
||||||
"pincode_changed_successfully": "PIN code changed successfully",
|
"pincode_changed_successfully": "PIN code changed successfully",
|
||||||
"pincode_created_successfully": "PIN code created successfully",
|
"pincode_created_successfully": "PIN code created successfully",
|
||||||
|
"pincode_reset_successfully": "PIN code reset successfully",
|
||||||
|
"reset_pincode": "Reset PIN code",
|
||||||
"create_pincode": "Create PIN code",
|
"create_pincode": "Create PIN code",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"account": "Account",
|
"account": "Account",
|
||||||
|
@ -63,6 +65,7 @@
|
||||||
"confirm_email_below": "To confirm, type \"{email}\" below",
|
"confirm_email_below": "To confirm, type \"{email}\" below",
|
||||||
"confirm_reprocess_all_faces": "Are you sure you want to reprocess all faces? This will also clear named people.",
|
"confirm_reprocess_all_faces": "Are you sure you want to reprocess all faces? This will also clear named people.",
|
||||||
"confirm_user_password_reset": "Are you sure you want to reset {user}'s password?",
|
"confirm_user_password_reset": "Are you sure you want to reset {user}'s password?",
|
||||||
|
"confirm_user_pincode_reset": "Are you sure you want to reset {user}'s PIN code?",
|
||||||
"create_job": "Create job",
|
"create_job": "Create job",
|
||||||
"cron_expression": "Cron expression",
|
"cron_expression": "Cron expression",
|
||||||
"cron_expression_description": "Set the scanning interval using the cron format. For more information please refer to e.g. <link>Crontab Guru</link>",
|
"cron_expression_description": "Set the scanning interval using the cron format. For more information please refer to e.g. <link>Crontab Guru</link>",
|
||||||
|
@ -932,6 +935,7 @@
|
||||||
"unable_to_remove_reaction": "Unable to remove reaction",
|
"unable_to_remove_reaction": "Unable to remove reaction",
|
||||||
"unable_to_repair_items": "Unable to repair items",
|
"unable_to_repair_items": "Unable to repair items",
|
||||||
"unable_to_reset_password": "Unable to reset password",
|
"unable_to_reset_password": "Unable to reset password",
|
||||||
|
"unable_to_reset_pincode": "Unable to reset PIN code",
|
||||||
"unable_to_resolve_duplicate": "Unable to resolve duplicate",
|
"unable_to_resolve_duplicate": "Unable to resolve duplicate",
|
||||||
"unable_to_restore_assets": "Unable to restore assets",
|
"unable_to_restore_assets": "Unable to restore assets",
|
||||||
"unable_to_restore_trash": "Unable to restore trash",
|
"unable_to_restore_trash": "Unable to restore trash",
|
||||||
|
|
2
mobile/openapi/README.md
generated
2
mobile/openapi/README.md
generated
|
@ -114,6 +114,7 @@ Class | Method | HTTP request | Description
|
||||||
*AuthenticationApi* | [**getAuthStatus**](doc//AuthenticationApi.md#getauthstatus) | **GET** /auth/status |
|
*AuthenticationApi* | [**getAuthStatus**](doc//AuthenticationApi.md#getauthstatus) | **GET** /auth/status |
|
||||||
*AuthenticationApi* | [**login**](doc//AuthenticationApi.md#login) | **POST** /auth/login |
|
*AuthenticationApi* | [**login**](doc//AuthenticationApi.md#login) | **POST** /auth/login |
|
||||||
*AuthenticationApi* | [**logout**](doc//AuthenticationApi.md#logout) | **POST** /auth/logout |
|
*AuthenticationApi* | [**logout**](doc//AuthenticationApi.md#logout) | **POST** /auth/logout |
|
||||||
|
*AuthenticationApi* | [**resetPincode**](doc//AuthenticationApi.md#resetpincode) | **POST** /auth/reset-pincode |
|
||||||
*AuthenticationApi* | [**signUpAdmin**](doc//AuthenticationApi.md#signupadmin) | **POST** /auth/admin-sign-up |
|
*AuthenticationApi* | [**signUpAdmin**](doc//AuthenticationApi.md#signupadmin) | **POST** /auth/admin-sign-up |
|
||||||
*AuthenticationApi* | [**validateAccessToken**](doc//AuthenticationApi.md#validateaccesstoken) | **POST** /auth/validateToken |
|
*AuthenticationApi* | [**validateAccessToken**](doc//AuthenticationApi.md#validateaccesstoken) | **POST** /auth/validateToken |
|
||||||
*DeprecatedApi* | [**getRandom**](doc//DeprecatedApi.md#getrandom) | **GET** /assets/random |
|
*DeprecatedApi* | [**getRandom**](doc//DeprecatedApi.md#getrandom) | **GET** /assets/random |
|
||||||
|
@ -398,6 +399,7 @@ Class | Method | HTTP request | Description
|
||||||
- [RatingsUpdate](doc//RatingsUpdate.md)
|
- [RatingsUpdate](doc//RatingsUpdate.md)
|
||||||
- [ReactionLevel](doc//ReactionLevel.md)
|
- [ReactionLevel](doc//ReactionLevel.md)
|
||||||
- [ReactionType](doc//ReactionType.md)
|
- [ReactionType](doc//ReactionType.md)
|
||||||
|
- [ResetPincodeDto](doc//ResetPincodeDto.md)
|
||||||
- [ReverseGeocodingStateResponseDto](doc//ReverseGeocodingStateResponseDto.md)
|
- [ReverseGeocodingStateResponseDto](doc//ReverseGeocodingStateResponseDto.md)
|
||||||
- [SearchAlbumResponseDto](doc//SearchAlbumResponseDto.md)
|
- [SearchAlbumResponseDto](doc//SearchAlbumResponseDto.md)
|
||||||
- [SearchAssetResponseDto](doc//SearchAssetResponseDto.md)
|
- [SearchAssetResponseDto](doc//SearchAssetResponseDto.md)
|
||||||
|
|
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
|
@ -199,6 +199,7 @@ part 'model/ratings_response.dart';
|
||||||
part 'model/ratings_update.dart';
|
part 'model/ratings_update.dart';
|
||||||
part 'model/reaction_level.dart';
|
part 'model/reaction_level.dart';
|
||||||
part 'model/reaction_type.dart';
|
part 'model/reaction_type.dart';
|
||||||
|
part 'model/reset_pincode_dto.dart';
|
||||||
part 'model/reverse_geocoding_state_response_dto.dart';
|
part 'model/reverse_geocoding_state_response_dto.dart';
|
||||||
part 'model/search_album_response_dto.dart';
|
part 'model/search_album_response_dto.dart';
|
||||||
part 'model/search_asset_response_dto.dart';
|
part 'model/search_asset_response_dto.dart';
|
||||||
|
|
47
mobile/openapi/lib/api/authentication_api.dart
generated
47
mobile/openapi/lib/api/authentication_api.dart
generated
|
@ -286,6 +286,53 @@ class AuthenticationApi {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Performs an HTTP 'POST /auth/reset-pincode' operation and returns the [Response].
|
||||||
|
/// Parameters:
|
||||||
|
///
|
||||||
|
/// * [ResetPincodeDto] resetPincodeDto (required):
|
||||||
|
Future<Response> resetPincodeWithHttpInfo(ResetPincodeDto resetPincodeDto,) async {
|
||||||
|
// ignore: prefer_const_declarations
|
||||||
|
final apiPath = r'/auth/reset-pincode';
|
||||||
|
|
||||||
|
// ignore: prefer_final_locals
|
||||||
|
Object? postBody = resetPincodeDto;
|
||||||
|
|
||||||
|
final queryParams = <QueryParam>[];
|
||||||
|
final headerParams = <String, String>{};
|
||||||
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
const contentTypes = <String>['application/json'];
|
||||||
|
|
||||||
|
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
apiPath,
|
||||||
|
'POST',
|
||||||
|
queryParams,
|
||||||
|
postBody,
|
||||||
|
headerParams,
|
||||||
|
formParams,
|
||||||
|
contentTypes.isEmpty ? null : contentTypes.first,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parameters:
|
||||||
|
///
|
||||||
|
/// * [ResetPincodeDto] resetPincodeDto (required):
|
||||||
|
Future<UserAdminResponseDto?> resetPincode(ResetPincodeDto resetPincodeDto,) async {
|
||||||
|
final response = await resetPincodeWithHttpInfo(resetPincodeDto,);
|
||||||
|
if (response.statusCode >= HttpStatus.badRequest) {
|
||||||
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||||
|
}
|
||||||
|
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||||
|
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||||
|
// FormatException when trying to decode an empty string.
|
||||||
|
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||||
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserAdminResponseDto',) as UserAdminResponseDto;
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Performs an HTTP 'POST /auth/admin-sign-up' operation and returns the [Response].
|
/// Performs an HTTP 'POST /auth/admin-sign-up' operation and returns the [Response].
|
||||||
/// Parameters:
|
/// Parameters:
|
||||||
///
|
///
|
||||||
|
|
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
|
@ -454,6 +454,8 @@ class ApiClient {
|
||||||
return ReactionLevelTypeTransformer().decode(value);
|
return ReactionLevelTypeTransformer().decode(value);
|
||||||
case 'ReactionType':
|
case 'ReactionType':
|
||||||
return ReactionTypeTypeTransformer().decode(value);
|
return ReactionTypeTypeTransformer().decode(value);
|
||||||
|
case 'ResetPincodeDto':
|
||||||
|
return ResetPincodeDto.fromJson(value);
|
||||||
case 'ReverseGeocodingStateResponseDto':
|
case 'ReverseGeocodingStateResponseDto':
|
||||||
return ReverseGeocodingStateResponseDto.fromJson(value);
|
return ReverseGeocodingStateResponseDto.fromJson(value);
|
||||||
case 'SearchAlbumResponseDto':
|
case 'SearchAlbumResponseDto':
|
||||||
|
|
99
mobile/openapi/lib/model/reset_pincode_dto.dart
generated
Normal file
99
mobile/openapi/lib/model/reset_pincode_dto.dart
generated
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class ResetPincodeDto {
|
||||||
|
/// Returns a new [ResetPincodeDto] instance.
|
||||||
|
ResetPincodeDto({
|
||||||
|
required this.userId,
|
||||||
|
});
|
||||||
|
|
||||||
|
String userId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ResetPincodeDto &&
|
||||||
|
other.userId == userId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(userId.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'ResetPincodeDto[userId=$userId]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'userId'] = this.userId;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [ResetPincodeDto] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static ResetPincodeDto? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "ResetPincodeDto");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return ResetPincodeDto(
|
||||||
|
userId: mapValueOfType<String>(json, r'userId')!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<ResetPincodeDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <ResetPincodeDto>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = ResetPincodeDto.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, ResetPincodeDto> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, ResetPincodeDto>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = ResetPincodeDto.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ResetPincodeDto-objects as value to a dart map
|
||||||
|
static Map<String, List<ResetPincodeDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<ResetPincodeDto>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = ResetPincodeDto.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
'userId',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -517,6 +517,9 @@ export type LogoutResponseDto = {
|
||||||
redirectUri: string;
|
redirectUri: string;
|
||||||
successful: boolean;
|
successful: boolean;
|
||||||
};
|
};
|
||||||
|
export type ResetPincodeDto = {
|
||||||
|
userId: string;
|
||||||
|
};
|
||||||
export type AuthStatusResponseDto = {
|
export type AuthStatusResponseDto = {
|
||||||
hasPincode: boolean;
|
hasPincode: boolean;
|
||||||
};
|
};
|
||||||
|
@ -2051,6 +2054,18 @@ export function logout(opts?: Oazapfts.RequestOpts) {
|
||||||
method: "POST"
|
method: "POST"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
export function resetPincode({ resetPincodeDto }: {
|
||||||
|
resetPincodeDto: ResetPincodeDto;
|
||||||
|
}, opts?: Oazapfts.RequestOpts) {
|
||||||
|
return oazapfts.ok(oazapfts.fetchJson<{
|
||||||
|
status: 200;
|
||||||
|
data: UserAdminResponseDto;
|
||||||
|
}>("/auth/reset-pincode", oazapfts.json({
|
||||||
|
...opts,
|
||||||
|
method: "POST",
|
||||||
|
body: resetPincodeDto
|
||||||
|
})));
|
||||||
|
}
|
||||||
export function getAuthStatus(opts?: Oazapfts.RequestOpts) {
|
export function getAuthStatus(opts?: Oazapfts.RequestOpts) {
|
||||||
return oazapfts.ok(oazapfts.fetchJson<{
|
return oazapfts.ok(oazapfts.fetchJson<{
|
||||||
status: 200;
|
status: 200;
|
||||||
|
|
|
@ -90,13 +90,13 @@ export class UserRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GenerateSql({ params: [DummyValue.EMAIL] })
|
@GenerateSql({ params: [DummyValue.EMAIL] })
|
||||||
getByEmail(email: string, withPassword?: boolean, withPincode?: boolean) {
|
getByEmail(email: string, options?: { withPassword?: boolean; withPincode?: boolean }) {
|
||||||
return this.db
|
return this.db
|
||||||
.selectFrom('users')
|
.selectFrom('users')
|
||||||
.select(columns.userAdmin)
|
.select(columns.userAdmin)
|
||||||
.select(withMetadata)
|
.select(withMetadata)
|
||||||
.$if(!!withPassword, (eb) => eb.select('password'))
|
.$if(!!options?.withPassword, (eb) => eb.select('password'))
|
||||||
.$if(!!withPincode, (eb) => eb.select('pincode'))
|
.$if(!!options?.withPincode, (eb) => eb.select('pincode'))
|
||||||
.where('email', '=', email)
|
.where('email', '=', email)
|
||||||
.where('users.deletedAt', 'is', null)
|
.where('users.deletedAt', 'is', null)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { AssetStatus, SourceType } from 'src/enum';
|
import { AssetStatus, AssetVisibility, SourceType } from 'src/enum';
|
||||||
import { registerEnum } from 'src/sql-tools';
|
import { registerEnum } from 'src/sql-tools';
|
||||||
|
|
||||||
export const assets_status_enum = registerEnum({
|
export const assets_status_enum = registerEnum({
|
||||||
|
@ -10,3 +10,8 @@ export const asset_face_source_type = registerEnum({
|
||||||
name: 'sourcetype',
|
name: 'sourcetype',
|
||||||
values: Object.values(SourceType),
|
values: Object.values(SourceType),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const asset_visibility_enum = registerEnum({
|
||||||
|
name: 'asset_visibility_enum',
|
||||||
|
values: Object.values(AssetVisibility),
|
||||||
|
});
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { AssetVisibility } from 'src/enum';
|
import { asset_face_source_type, asset_visibility_enum, assets_status_enum } from 'src/schema/enums';
|
||||||
import { asset_face_source_type, assets_status_enum } from 'src/schema/enums';
|
|
||||||
import {
|
import {
|
||||||
assets_delete_audit,
|
assets_delete_audit,
|
||||||
f_concat_ws,
|
f_concat_ws,
|
||||||
|
@ -46,12 +45,7 @@ import { UserAuditTable } from 'src/schema/tables/user-audit.table';
|
||||||
import { UserMetadataTable } from 'src/schema/tables/user-metadata.table';
|
import { UserMetadataTable } from 'src/schema/tables/user-metadata.table';
|
||||||
import { UserTable } from 'src/schema/tables/user.table';
|
import { UserTable } from 'src/schema/tables/user.table';
|
||||||
import { VersionHistoryTable } from 'src/schema/tables/version-history.table';
|
import { VersionHistoryTable } from 'src/schema/tables/version-history.table';
|
||||||
import { ConfigurationParameter, Database, Extensions, registerEnum } from 'src/sql-tools';
|
import { ConfigurationParameter, Database, Extensions } from 'src/sql-tools';
|
||||||
|
|
||||||
export const asset_visibility_enum = registerEnum({
|
|
||||||
name: 'asset_visibility_enum',
|
|
||||||
values: Object.values(AssetVisibility),
|
|
||||||
});
|
|
||||||
|
|
||||||
@Extensions(['uuid-ossp', 'unaccent', 'cube', 'earthdistance', 'pg_trgm', 'plpgsql'])
|
@Extensions(['uuid-ossp', 'unaccent', 'cube', 'earthdistance', 'pg_trgm', 'plpgsql'])
|
||||||
@ConfigurationParameter({ name: 'search_path', value: () => '"$user", public, vectors', scope: 'database' })
|
@ConfigurationParameter({ name: 'search_path', value: () => '"$user", public, vectors', scope: 'database' })
|
||||||
|
@ -107,5 +101,5 @@ export class ImmichDatabase {
|
||||||
assets_delete_audit,
|
assets_delete_audit,
|
||||||
];
|
];
|
||||||
|
|
||||||
enum = [assets_status_enum, asset_face_source_type];
|
enum = [assets_status_enum, asset_face_source_type, asset_visibility_enum];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
const { rows } = await sql<{ db: string }>`SELECT current_database() as db`.execute(db);
|
||||||
|
const databaseName = rows[0].db;
|
||||||
|
await sql.raw(`ALTER DATABASE "${databaseName}" SET search_path TO "$user", public, vectors`).execute(db);
|
||||||
|
await sql`ALTER TABLE "naturalearth_countries" DROP CONSTRAINT IF EXISTS "PK_21a6d86d1ab5d841648212e5353";`.execute(db);
|
||||||
|
await sql`ALTER TABLE "naturalearth_countries" DROP CONSTRAINT IF EXISTS "naturalearth_countries_pkey";`.execute(db);
|
||||||
|
await sql`ALTER TABLE "naturalearth_countries" ADD CONSTRAINT "naturalearth_countries_pkey" PRIMARY KEY ("id") WITH (FILLFACTOR = 100);`.execute(db);
|
||||||
|
await sql`DROP INDEX IF EXISTS "IDX_02a43fd0b3c50fb6d7f0cb7282";`.execute(db);
|
||||||
|
await sql`DROP INDEX IF EXISTS "IDX_95ad7106dd7b484275443f580f";`.execute(db);
|
||||||
|
await sql`DROP INDEX IF EXISTS "IDX_7e077a8b70b3530138610ff5e0";`.execute(db);
|
||||||
|
await sql`DROP INDEX IF EXISTS "IDX_92e67dc508c705dd66c9461557";`.execute(db);
|
||||||
|
await sql`DROP INDEX IF EXISTS "IDX_6afb43681a21cf7815932bc38a";`.execute(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
const { rows } = await sql<{ db: string }>`SELECT current_database() as db`.execute(db);
|
||||||
|
const databaseName = rows[0].db;
|
||||||
|
await sql.raw(`ALTER DATABASE "${databaseName}" RESET "search_path"`).execute(db);
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
import { UpdatedAtTrigger, UpdateIdColumn } from 'src/decorators';
|
import { UpdatedAtTrigger, UpdateIdColumn } from 'src/decorators';
|
||||||
import { AssetStatus, AssetType, AssetVisibility } from 'src/enum';
|
import { AssetStatus, AssetType, AssetVisibility } from 'src/enum';
|
||||||
import { asset_visibility_enum } from 'src/schema';
|
import { asset_visibility_enum, assets_status_enum } from 'src/schema/enums';
|
||||||
import { assets_status_enum } from 'src/schema/enums';
|
|
||||||
import { assets_delete_audit } from 'src/schema/functions';
|
import { assets_delete_audit } from 'src/schema/functions';
|
||||||
import { LibraryTable } from 'src/schema/tables/library.table';
|
import { LibraryTable } from 'src/schema/tables/library.table';
|
||||||
import { StackTable } from 'src/schema/tables/stack.table';
|
import { StackTable } from 'src/schema/tables/stack.table';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Column, PrimaryGeneratedColumn, Table } from 'src/sql-tools';
|
import { Column, PrimaryGeneratedColumn, Table } from 'src/sql-tools';
|
||||||
|
|
||||||
@Table({ name: 'naturalearth_countries' })
|
@Table({ name: 'naturalearth_countries', primaryConstraintName: 'naturalearth_countries_pkey' })
|
||||||
export class NaturalEarthCountriesTable {
|
export class NaturalEarthCountriesTable {
|
||||||
@PrimaryGeneratedColumn({ strategy: 'identity' })
|
@PrimaryGeneratedColumn({ strategy: 'identity' })
|
||||||
id!: number;
|
id!: number;
|
||||||
|
|
|
@ -119,7 +119,7 @@ describe(AuthService.name, () => {
|
||||||
|
|
||||||
await sut.changePassword(auth, dto);
|
await sut.changePassword(auth, dto);
|
||||||
|
|
||||||
expect(mocks.user.getByEmail).toHaveBeenCalledWith(auth.user.email, true);
|
expect(mocks.user.getByEmail).toHaveBeenCalledWith(auth.user.email, { withPassword: true });
|
||||||
expect(mocks.crypto.compareBcrypt).toHaveBeenCalledWith('old-password', 'hash-password');
|
expect(mocks.crypto.compareBcrypt).toHaveBeenCalledWith('old-password', 'hash-password');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -872,7 +872,7 @@ describe(AuthService.name, () => {
|
||||||
|
|
||||||
await sut.createPincode(auth, dto);
|
await sut.createPincode(auth, dto);
|
||||||
|
|
||||||
expect(mocks.user.getByEmail).toHaveBeenCalledWith(auth.user.email, false, true);
|
expect(mocks.user.getByEmail).toHaveBeenCalledWith(auth.user.email, { withPincode: true });
|
||||||
expect(mocks.crypto.hashBcrypt).toHaveBeenCalledWith('new-pincode', SALT_ROUNDS);
|
expect(mocks.crypto.hashBcrypt).toHaveBeenCalledWith('new-pincode', SALT_ROUNDS);
|
||||||
expect(mocks.user.update).toHaveBeenCalledWith(user.id, { pincode: expect.any(String) });
|
expect(mocks.user.update).toHaveBeenCalledWith(user.id, { pincode: expect.any(String) });
|
||||||
});
|
});
|
||||||
|
@ -900,7 +900,7 @@ describe(AuthService.name, () => {
|
||||||
|
|
||||||
await sut.changePincode(auth, dto);
|
await sut.changePincode(auth, dto);
|
||||||
|
|
||||||
expect(mocks.user.getByEmail).toHaveBeenCalledWith(auth.user.email, false, true);
|
expect(mocks.user.getByEmail).toHaveBeenCalledWith(auth.user.email, { withPincode: true });
|
||||||
expect(mocks.crypto.compareBcrypt).toHaveBeenCalledWith('old-pincode', 'hash-pincode');
|
expect(mocks.crypto.compareBcrypt).toHaveBeenCalledWith('old-pincode', 'hash-pincode');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,9 @@ export class AuthService extends BaseService {
|
||||||
throw new UnauthorizedException('Password login has been disabled');
|
throw new UnauthorizedException('Password login has been disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
let user = await this.userRepository.getByEmail(dto.email, true);
|
let user = await this.userRepository.getByEmail(dto.email, { withPassword: true });
|
||||||
if (user) {
|
if (user) {
|
||||||
const isAuthenticated = this.validatePassword(dto.password, user);
|
const isAuthenticated = this.validateSecrect(dto.password, user.password);
|
||||||
if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
user = undefined;
|
user = undefined;
|
||||||
}
|
}
|
||||||
|
@ -90,12 +90,12 @@ export class AuthService extends BaseService {
|
||||||
|
|
||||||
async changePassword(auth: AuthDto, dto: ChangePasswordDto): Promise<UserAdminResponseDto> {
|
async changePassword(auth: AuthDto, dto: ChangePasswordDto): Promise<UserAdminResponseDto> {
|
||||||
const { password, newPassword } = dto;
|
const { password, newPassword } = dto;
|
||||||
const user = await this.userRepository.getByEmail(auth.user.email, true);
|
const user = await this.userRepository.getByEmail(auth.user.email, { withPassword: true });
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
const valid = this.validatePassword(password, user);
|
const valid = this.validateSecrect(password, user.password);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new BadRequestException('Wrong password');
|
throw new BadRequestException('Wrong password');
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ export class AuthService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async createPincode(auth: AuthDto, { pincode }: createPincodeDto): Promise<UserAdminResponseDto> {
|
async createPincode(auth: AuthDto, { pincode }: createPincodeDto): Promise<UserAdminResponseDto> {
|
||||||
const user = await this.userRepository.getByEmail(auth.user.email, false, true);
|
const user = await this.userRepository.getByEmail(auth.user.email, { withPincode: true });
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
|
@ -127,18 +127,18 @@ export class AuthService extends BaseService {
|
||||||
async changePincode(auth: AuthDto, dto: ChangePincodeDto): Promise<UserAdminResponseDto> {
|
async changePincode(auth: AuthDto, dto: ChangePincodeDto): Promise<UserAdminResponseDto> {
|
||||||
const { pincode, newPincode } = dto;
|
const { pincode, newPincode } = dto;
|
||||||
|
|
||||||
const user = await this.userRepository.getByEmail(auth.user.email, false, true);
|
const user = await this.userRepository.getByEmail(auth.user.email, { withPincode: true });
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
const valid = this.validatePincode(pincode, user);
|
const valid = this.validateSecrect(pincode, user.pincode);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new BadRequestException('Wrong pincode');
|
throw new BadRequestException('Wrong pincode');
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasedPincode = await this.cryptoRepository.hashBcrypt(newPincode.toString(), SALT_ROUNDS);
|
const hashedPincode = await this.cryptoRepository.hashBcrypt(newPincode.toString(), SALT_ROUNDS);
|
||||||
const updatedUser = await this.userRepository.update(user.id, { pincode: hasedPincode });
|
const updatedUser = await this.userRepository.update(user.id, { pincode: hashedPincode });
|
||||||
|
|
||||||
return mapUserAdmin(updatedUser);
|
return mapUserAdmin(updatedUser);
|
||||||
}
|
}
|
||||||
|
@ -411,18 +411,12 @@ export class AuthService extends BaseService {
|
||||||
throw new UnauthorizedException('Invalid API key');
|
throw new UnauthorizedException('Invalid API key');
|
||||||
}
|
}
|
||||||
|
|
||||||
private validatePassword(inputPassword: string, user: { password?: string }): boolean {
|
private validateSecrect(inputSecret: string, existingHash?: string | null): boolean {
|
||||||
if (!user || !user.password) {
|
if (!existingHash) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return this.cryptoRepository.compareBcrypt(inputPassword, user.password);
|
|
||||||
}
|
|
||||||
|
|
||||||
private validatePincode(inputPincode: string, user: { pincode?: string | null }): boolean {
|
return this.cryptoRepository.compareBcrypt(inputSecret, existingHash);
|
||||||
if (!user || !user.pincode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return this.cryptoRepository.compareBcrypt(inputPincode, user.pincode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async validateSession(tokenValue: string): Promise<AuthDto> {
|
private async validateSession(tokenValue: string): Promise<AuthDto> {
|
||||||
|
@ -477,20 +471,14 @@ export class AuthService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAuthStatus(auth: AuthDto): Promise<AuthStatusResponseDto> {
|
async getAuthStatus(auth: AuthDto): Promise<AuthStatusResponseDto> {
|
||||||
const hasPincode = await this.hasPincode(auth);
|
const user = await this.userRepository.getByEmail(auth.user.email, { withPincode: true });
|
||||||
|
|
||||||
return {
|
|
||||||
hasPincode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private async hasPincode(auth: AuthDto): Promise<boolean> {
|
|
||||||
const user = await this.userRepository.getByEmail(auth.user.email, false, true);
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!user.pincode;
|
return {
|
||||||
|
hasPincode: !!user.pincode,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async resetPincode(auth: AuthDto, dto: ResetPincodeDto): Promise<UserAdminResponseDto> {
|
async resetPincode(auth: AuthDto, dto: ResetPincodeDto): Promise<UserAdminResponseDto> {
|
||||||
|
|
|
@ -130,6 +130,7 @@
|
||||||
clickable={false}
|
clickable={false}
|
||||||
bind:mapMarkers
|
bind:mapMarkers
|
||||||
onSelect={onViewAssets}
|
onSelect={onViewAssets}
|
||||||
|
showSettings={false}
|
||||||
/>
|
/>
|
||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -494,6 +494,7 @@
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
center={latlng}
|
center={latlng}
|
||||||
|
showSettings={false}
|
||||||
zoom={12.5}
|
zoom={12.5}
|
||||||
simplified
|
simplified
|
||||||
useLocationPin
|
useLocationPin
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { mdiKeyVariant } from '@mdi/js';
|
|
||||||
import { t } from 'svelte-i18n';
|
|
||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
|
||||||
import { NotificationType, notificationController } from '../shared-components/notification/notification';
|
|
||||||
import { Button } from '@immich/ui';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
apiKey: { name: string };
|
|
||||||
title: string;
|
|
||||||
cancelText?: string;
|
|
||||||
submitText?: string;
|
|
||||||
onSubmit: (apiKey: { name: string }) => void;
|
|
||||||
onCancel: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
let {
|
|
||||||
apiKey = $bindable(),
|
|
||||||
title,
|
|
||||||
cancelText = $t('cancel'),
|
|
||||||
submitText = $t('save'),
|
|
||||||
onSubmit,
|
|
||||||
onCancel,
|
|
||||||
}: Props = $props();
|
|
||||||
|
|
||||||
const handleSubmit = () => {
|
|
||||||
if (apiKey.name) {
|
|
||||||
onSubmit({ name: apiKey.name });
|
|
||||||
} else {
|
|
||||||
notificationController.show({
|
|
||||||
message: $t('api_key_empty'),
|
|
||||||
type: NotificationType.Warning,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onsubmit = (event: Event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
handleSubmit();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<FullScreenModal {title} icon={mdiKeyVariant} onClose={() => onCancel()}>
|
|
||||||
<form {onsubmit} autocomplete="off" id="api-key-form">
|
|
||||||
<div class="mb-4 flex flex-col gap-2">
|
|
||||||
<label class="immich-form-label" for="name">{$t('name')}</label>
|
|
||||||
<input class="immich-form-input" id="name" name="name" type="text" bind:value={apiKey.name} />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{#snippet stickyBottom()}
|
|
||||||
<Button shape="round" color="secondary" fullWidth onclick={() => onCancel()}>{cancelText}</Button>
|
|
||||||
<Button shape="round" type="submit" fullWidth form="api-key-form">{submitText}</Button>
|
|
||||||
{/snippet}
|
|
||||||
</FullScreenModal>
|
|
|
@ -1,32 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import { copyToClipboard } from '$lib/utils';
|
|
||||||
import { Button } from '@immich/ui';
|
|
||||||
import { mdiKeyVariant } from '@mdi/js';
|
|
||||||
import { t } from 'svelte-i18n';
|
|
||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
secret?: string;
|
|
||||||
onDone: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { secret = '', onDone }: Props = $props();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<FullScreenModal title={$t('api_key')} icon={mdiKeyVariant} onClose={onDone}>
|
|
||||||
<div class="text-immich-primary dark:text-immich-dark-primary">
|
|
||||||
<p class="text-sm dark:text-immich-dark-fg">
|
|
||||||
{$t('api_key_description')}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="my-4 flex flex-col gap-2">
|
|
||||||
<!-- <label class="immich-form-label" for="secret">{ $t("api_key") }</label> -->
|
|
||||||
<textarea class="immich-form-input" id="secret" name="secret" readonly={true} value={secret}></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#snippet stickyBottom()}
|
|
||||||
<Button shape="round" onclick={() => copyToClipboard(secret)} fullWidth>{$t('copy_to_clipboard')}</Button>
|
|
||||||
<Button shape="round" onclick={onDone} fullWidth>{$t('done')}</Button>
|
|
||||||
{/snippet}
|
|
||||||
</FullScreenModal>
|
|
|
@ -1,133 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
|
|
||||||
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
|
||||||
import type { MapSettings } from '$lib/stores/preferences.store';
|
|
||||||
import { Button, Field, Stack, Switch } from '@immich/ui';
|
|
||||||
import { Duration } from 'luxon';
|
|
||||||
import { t } from 'svelte-i18n';
|
|
||||||
import { fly } from 'svelte/transition';
|
|
||||||
import DateInput from '../elements/date-input.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
settings: MapSettings;
|
|
||||||
onClose: () => void;
|
|
||||||
onSave: (settings: MapSettings) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { settings: initialValues, onClose, onSave }: Props = $props();
|
|
||||||
let settings = $state(initialValues);
|
|
||||||
|
|
||||||
let customDateRange = $state(!!settings.dateAfter || !!settings.dateBefore);
|
|
||||||
|
|
||||||
const onsubmit = (event: Event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
onSave(settings);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<form {onsubmit}>
|
|
||||||
<FullScreenModal title={$t('map_settings')} {onClose}>
|
|
||||||
<Stack gap={4}>
|
|
||||||
<Field label={$t('allow_dark_mode')}>
|
|
||||||
<Switch bind:checked={settings.allowDarkMode} />
|
|
||||||
</Field>
|
|
||||||
<Field label={$t('only_favorites')}>
|
|
||||||
<Switch bind:checked={settings.onlyFavorites} />
|
|
||||||
</Field>
|
|
||||||
<Field label={$t('include_archived')}>
|
|
||||||
<Switch bind:checked={settings.includeArchived} />
|
|
||||||
</Field>
|
|
||||||
<Field label={$t('include_shared_partner_assets')}>
|
|
||||||
<Switch bind:checked={settings.withPartners} />
|
|
||||||
</Field>
|
|
||||||
<Field label={$t('include_shared_albums')}>
|
|
||||||
<Switch bind:checked={settings.withSharedAlbums} />
|
|
||||||
</Field>
|
|
||||||
|
|
||||||
{#if customDateRange}
|
|
||||||
<div in:fly={{ y: 10, duration: 200 }} class="flex flex-col gap-4">
|
|
||||||
<div class="flex items-center justify-between gap-8">
|
|
||||||
<label class="immich-form-label shrink-0 text-sm" for="date-after">{$t('date_after')}</label>
|
|
||||||
<DateInput
|
|
||||||
class="immich-form-input w-40"
|
|
||||||
type="date"
|
|
||||||
id="date-after"
|
|
||||||
max={settings.dateBefore}
|
|
||||||
bind:value={settings.dateAfter}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between gap-8">
|
|
||||||
<label class="immich-form-label shrink-0 text-sm" for="date-before">{$t('date_before')}</label>
|
|
||||||
<DateInput class="immich-form-input w-40" type="date" id="date-before" bind:value={settings.dateBefore} />
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-center text-xs">
|
|
||||||
<Button
|
|
||||||
color="primary"
|
|
||||||
size="small"
|
|
||||||
variant="ghost"
|
|
||||||
onclick={() => {
|
|
||||||
customDateRange = false;
|
|
||||||
settings.dateAfter = '';
|
|
||||||
settings.dateBefore = '';
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{$t('remove_custom_date_range')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div in:fly={{ y: -10, duration: 200 }} class="flex flex-col gap-1">
|
|
||||||
<SettingSelect
|
|
||||||
label={$t('date_range')}
|
|
||||||
name="date-range"
|
|
||||||
bind:value={settings.relativeDate}
|
|
||||||
options={[
|
|
||||||
{
|
|
||||||
value: '',
|
|
||||||
text: $t('all'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: Duration.fromObject({ hours: 24 }).toISO() || '',
|
|
||||||
text: $t('past_durations.hours', { values: { hours: 24 } }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: Duration.fromObject({ days: 7 }).toISO() || '',
|
|
||||||
text: $t('past_durations.days', { values: { days: 7 } }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: Duration.fromObject({ days: 30 }).toISO() || '',
|
|
||||||
text: $t('past_durations.days', { values: { days: 30 } }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: Duration.fromObject({ years: 1 }).toISO() || '',
|
|
||||||
text: $t('past_durations.years', { values: { years: 1 } }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: Duration.fromObject({ years: 3 }).toISO() || '',
|
|
||||||
text: $t('past_durations.years', { values: { years: 3 } }),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
<div class="text-xs">
|
|
||||||
<Button
|
|
||||||
color="primary"
|
|
||||||
size="small"
|
|
||||||
variant="ghost"
|
|
||||||
onclick={() => {
|
|
||||||
customDateRange = true;
|
|
||||||
settings.relativeDate = '';
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{$t('use_custom_date_range')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
{#snippet stickyBottom()}
|
|
||||||
<Button color="secondary" shape="round" fullWidth onclick={onClose}>{$t('cancel')}</Button>
|
|
||||||
<Button type="submit" shape="round" fullWidth>{$t('save')}</Button>
|
|
||||||
{/snippet}
|
|
||||||
</FullScreenModal>
|
|
||||||
</form>
|
|
|
@ -190,6 +190,7 @@
|
||||||
simplified={true}
|
simplified={true}
|
||||||
clickable={true}
|
clickable={true}
|
||||||
onClickPoint={(selected) => (point = selected)}
|
onClickPoint={(selected) => (point = selected)}
|
||||||
|
showSettings={false}
|
||||||
/>
|
/>
|
||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,15 +9,20 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
import { Theme } from '$lib/constants';
|
import { Theme } from '$lib/constants';
|
||||||
|
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||||
import { themeManager } from '$lib/managers/theme-manager.svelte';
|
import { themeManager } from '$lib/managers/theme-manager.svelte';
|
||||||
|
import MapSettingsModal from '$lib/modals/MapSettingsModal.svelte';
|
||||||
import { mapSettings } from '$lib/stores/preferences.store';
|
import { mapSettings } from '$lib/stores/preferences.store';
|
||||||
import { serverConfig } from '$lib/stores/server-config.store';
|
import { serverConfig } from '$lib/stores/server-config.store';
|
||||||
import { getAssetThumbnailUrl, handlePromiseError } from '$lib/utils';
|
import { getAssetThumbnailUrl, handlePromiseError } from '$lib/utils';
|
||||||
import { type MapMarkerResponseDto } from '@immich/sdk';
|
import { getMapMarkers, type MapMarkerResponseDto } from '@immich/sdk';
|
||||||
import mapboxRtlUrl from '@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js?url';
|
import mapboxRtlUrl from '@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js?url';
|
||||||
import { mdiCog, mdiMap, mdiMapMarker } from '@mdi/js';
|
import { mdiCog, mdiMap, mdiMapMarker } from '@mdi/js';
|
||||||
import type { Feature, GeoJsonProperties, Geometry, Point } from 'geojson';
|
import type { Feature, GeoJsonProperties, Geometry, Point } from 'geojson';
|
||||||
|
import { isEqual, omit } from 'lodash-es';
|
||||||
|
import { DateTime, Duration } from 'luxon';
|
||||||
import maplibregl, { GlobeControl, type GeoJSONSource, type LngLatLike } from 'maplibre-gl';
|
import maplibregl, { GlobeControl, type GeoJSONSource, type LngLatLike } from 'maplibre-gl';
|
||||||
|
import { onDestroy, onMount } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import {
|
import {
|
||||||
AttributionControl,
|
AttributionControl,
|
||||||
|
@ -36,8 +41,8 @@
|
||||||
} from 'svelte-maplibre';
|
} from 'svelte-maplibre';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
mapMarkers: MapMarkerResponseDto[];
|
mapMarkers?: MapMarkerResponseDto[];
|
||||||
showSettingsModal?: boolean | undefined;
|
showSettings?: boolean;
|
||||||
zoom?: number | undefined;
|
zoom?: number | undefined;
|
||||||
center?: LngLatLike | undefined;
|
center?: LngLatLike | undefined;
|
||||||
hash?: boolean;
|
hash?: boolean;
|
||||||
|
@ -51,8 +56,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
mapMarkers = $bindable(),
|
mapMarkers = $bindable([]),
|
||||||
showSettingsModal = $bindable(undefined),
|
showSettings = true,
|
||||||
zoom = undefined,
|
zoom = undefined,
|
||||||
center = $bindable(undefined),
|
center = $bindable(undefined),
|
||||||
hash = false,
|
hash = false,
|
||||||
|
@ -67,6 +72,7 @@
|
||||||
|
|
||||||
let map: maplibregl.Map | undefined = $state();
|
let map: maplibregl.Map | undefined = $state();
|
||||||
let marker: maplibregl.Marker | null = null;
|
let marker: maplibregl.Marker | null = null;
|
||||||
|
let abortController: AbortController;
|
||||||
|
|
||||||
const theme = $derived($mapSettings.allowDarkMode ? themeManager.value : Theme.LIGHT);
|
const theme = $derived($mapSettings.allowDarkMode ? themeManager.value : Theme.LIGHT);
|
||||||
const styleUrl = $derived(theme === Theme.DARK ? $serverConfig.mapDarkStyleUrl : $serverConfig.mapLightStyleUrl);
|
const styleUrl = $derived(theme === Theme.DARK ? $serverConfig.mapDarkStyleUrl : $serverConfig.mapLightStyleUrl);
|
||||||
|
@ -143,6 +149,72 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getFileCreatedDates() {
|
||||||
|
const { relativeDate, dateAfter, dateBefore } = $mapSettings;
|
||||||
|
|
||||||
|
if (relativeDate) {
|
||||||
|
const duration = Duration.fromISO(relativeDate);
|
||||||
|
return {
|
||||||
|
fileCreatedAfter: duration.isValid ? DateTime.now().minus(duration).toISO() : undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return {
|
||||||
|
fileCreatedAfter: dateAfter ? new Date(dateAfter).toISOString() : undefined,
|
||||||
|
fileCreatedBefore: dateBefore ? new Date(dateBefore).toISOString() : undefined,
|
||||||
|
};
|
||||||
|
} catch {
|
||||||
|
$mapSettings.dateAfter = '';
|
||||||
|
$mapSettings.dateBefore = '';
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadMapMarkers() {
|
||||||
|
if (abortController) {
|
||||||
|
abortController.abort();
|
||||||
|
}
|
||||||
|
abortController = new AbortController();
|
||||||
|
|
||||||
|
const { includeArchived, onlyFavorites, withPartners, withSharedAlbums } = $mapSettings;
|
||||||
|
const { fileCreatedAfter, fileCreatedBefore } = getFileCreatedDates();
|
||||||
|
|
||||||
|
return await getMapMarkers(
|
||||||
|
{
|
||||||
|
isArchived: includeArchived && undefined,
|
||||||
|
isFavorite: onlyFavorites || undefined,
|
||||||
|
fileCreatedAfter: fileCreatedAfter || undefined,
|
||||||
|
fileCreatedBefore,
|
||||||
|
withPartners: withPartners || undefined,
|
||||||
|
withSharedAlbums: withSharedAlbums || undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
signal: abortController.signal,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSettingsClick = async () => {
|
||||||
|
const settings = await modalManager.show(MapSettingsModal, { settings: { ...$mapSettings } });
|
||||||
|
if (settings) {
|
||||||
|
const shouldUpdate = !isEqual(omit(settings, 'allowDarkMode'), omit($mapSettings, 'allowDarkMode'));
|
||||||
|
$mapSettings = settings;
|
||||||
|
|
||||||
|
if (shouldUpdate) {
|
||||||
|
mapMarkers = await loadMapMarkers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
mapMarkers = await loadMapMarkers();
|
||||||
|
});
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
abortController.abort();
|
||||||
|
});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
map?.setStyle(styleUrl, {
|
map?.setStyle(styleUrl, {
|
||||||
transformStyle: (previousStyle, nextStyle) => {
|
transformStyle: (previousStyle, nextStyle) => {
|
||||||
|
@ -199,10 +271,10 @@
|
||||||
<AttributionControl compact={false} />
|
<AttributionControl compact={false} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showSettingsModal !== undefined}
|
{#if showSettings}
|
||||||
<Control>
|
<Control>
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<ControlButton onclick={() => (showSettingsModal = true)}><Icon path={mdiCog} size="100%" /></ControlButton>
|
<ControlButton onclick={handleSettingsClick}><Icon path={mdiCog} size="100%" /></ControlButton>
|
||||||
</ControlGroup>
|
</ControlGroup>
|
||||||
</Control>
|
</Control>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import { clickOutside } from '$lib/actions/click-outside';
|
import { clickOutside } from '$lib/actions/click-outside';
|
||||||
import SkipLink from '$lib/components/elements/buttons/skip-link.svelte';
|
import SkipLink from '$lib/components/elements/buttons/skip-link.svelte';
|
||||||
import HelpAndFeedbackModal from '$lib/components/shared-components/help-and-feedback-modal.svelte';
|
|
||||||
import ImmichLogo from '$lib/components/shared-components/immich-logo.svelte';
|
import ImmichLogo from '$lib/components/shared-components/immich-logo.svelte';
|
||||||
import NotificationPanel from '$lib/components/shared-components/navigation-bar/notification-panel.svelte';
|
import NotificationPanel from '$lib/components/shared-components/navigation-bar/notification-panel.svelte';
|
||||||
import SearchBar from '$lib/components/shared-components/search-bar/search-bar.svelte';
|
import SearchBar from '$lib/components/shared-components/search-bar/search-bar.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import { authManager } from '$lib/managers/auth-manager.svelte';
|
import { authManager } from '$lib/managers/auth-manager.svelte';
|
||||||
|
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||||
|
import HelpAndFeedbackModal from '$lib/modals/HelpAndFeedbackModal.svelte';
|
||||||
import { mobileDevice } from '$lib/stores/mobile-device.svelte';
|
import { mobileDevice } from '$lib/stores/mobile-device.svelte';
|
||||||
import { notificationManager } from '$lib/stores/notification-manager.svelte';
|
import { notificationManager } from '$lib/stores/notification-manager.svelte';
|
||||||
import { featureFlags } from '$lib/stores/server-config.store';
|
import { featureFlags } from '$lib/stores/server-config.store';
|
||||||
|
@ -35,7 +36,6 @@
|
||||||
let { showUploadButton = true, onUploadClick }: Props = $props();
|
let { showUploadButton = true, onUploadClick }: Props = $props();
|
||||||
|
|
||||||
let shouldShowAccountInfoPanel = $state(false);
|
let shouldShowAccountInfoPanel = $state(false);
|
||||||
let shouldShowHelpPanel = $state(false);
|
|
||||||
let shouldShowNotificationPanel = $state(false);
|
let shouldShowNotificationPanel = $state(false);
|
||||||
let innerWidth: number = $state(0);
|
let innerWidth: number = $state(0);
|
||||||
const hasUnreadNotifications = $derived(notificationManager.notifications.length > 0);
|
const hasUnreadNotifications = $derived(notificationManager.notifications.length > 0);
|
||||||
|
@ -49,10 +49,6 @@
|
||||||
|
|
||||||
<svelte:window bind:innerWidth />
|
<svelte:window bind:innerWidth />
|
||||||
|
|
||||||
{#if shouldShowHelpPanel && info}
|
|
||||||
<HelpAndFeedbackModal onClose={() => (shouldShowHelpPanel = false)} {info} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<nav id="dashboard-navbar" class="z-auto max-md:h-[var(--navbar-height-md)] h-[var(--navbar-height)] w-dvw text-sm">
|
<nav id="dashboard-navbar" class="z-auto max-md:h-[var(--navbar-height-md)] h-[var(--navbar-height)] w-dvw text-sm">
|
||||||
<SkipLink text={$t('skip_to_content')} />
|
<SkipLink text={$t('skip_to_content')} />
|
||||||
<div
|
<div
|
||||||
|
@ -129,18 +125,14 @@
|
||||||
|
|
||||||
<ThemeButton padding="2" />
|
<ThemeButton padding="2" />
|
||||||
|
|
||||||
<div
|
<div>
|
||||||
use:clickOutside={{
|
|
||||||
onEscape: () => (shouldShowHelpPanel = false),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
shape="round"
|
shape="round"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="medium"
|
size="medium"
|
||||||
icon={mdiHelpCircleOutline}
|
icon={mdiHelpCircleOutline}
|
||||||
onclick={() => (shouldShowHelpPanel = !shouldShowHelpPanel)}
|
onclick={() => info && modalManager.show(HelpAndFeedbackModal, { info })}
|
||||||
aria-label={$t('support_and_feedback')}
|
aria-label={$t('support_and_feedback')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
const { isPurchased } = purchaseStore;
|
const { isPurchased } = purchaseStore;
|
||||||
|
|
||||||
const openPurchaseModal = async () => {
|
const openPurchaseModal = async () => {
|
||||||
await modalManager.open(PurchaseModal);
|
await modalManager.show(PurchaseModal, {});
|
||||||
showMessage = false;
|
showMessage = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
{#if $connected && version}
|
{#if $connected && version}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => info && modalManager.open(ServerAboutModal, { versions, info })}
|
onclick={() => info && modalManager.show(ServerAboutModal, { versions, info })}
|
||||||
class="dark:text-immich-gray flex gap-1"
|
class="dark:text-immich-gray flex gap-1"
|
||||||
>
|
>
|
||||||
{#if isMain}
|
{#if isMain}
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
let pinValues = $state(Array.from({ length: pinLength }).fill(''));
|
let pinValues = $state(Array.from({ length: pinLength }).fill(''));
|
||||||
let pincodeInputElements: HTMLInputElement[] = $state([]);
|
let pincodeInputElements: HTMLInputElement[] = $state([]);
|
||||||
|
|
||||||
export function reset() {
|
$effect(() => {
|
||||||
pinValues = Array.from({ length: pinLength }).fill('');
|
if (value === '') {
|
||||||
value = '';
|
pinValues = Array.from({ length: pinLength }).fill('');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const focusNext = (index: number) => {
|
const focusNext = (index: number) => {
|
||||||
if (index < pinLength - 1) {
|
if (index < pinLength - 1) {
|
||||||
|
@ -55,33 +56,37 @@
|
||||||
const target = event.currentTarget as HTMLInputElement;
|
const target = event.currentTarget as HTMLInputElement;
|
||||||
const index = pincodeInputElements.indexOf(target);
|
const index = pincodeInputElements.indexOf(target);
|
||||||
|
|
||||||
if (event.key === 'Tab') {
|
switch (event.key) {
|
||||||
return;
|
case 'Tab': {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (event.key === 'Backspace') {
|
case 'Backspace': {
|
||||||
if (target.value === '' && index > 0) {
|
if (target.value === '' && index > 0) {
|
||||||
focusPrev(index);
|
focusPrev(index);
|
||||||
pinValues[index - 1] = '';
|
pinValues[index - 1] = '';
|
||||||
} else if (target.value !== '') {
|
} else if (target.value !== '') {
|
||||||
pinValues[index] = '';
|
pinValues[index] = '';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case 'ArrowLeft': {
|
||||||
|
if (index > 0) {
|
||||||
|
focusPrev(index);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case 'ArrowRight': {
|
||||||
|
if (index < pinLength - 1) {
|
||||||
|
focusNext(index);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
if (!/^\d$/.test(event.key)) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === 'ArrowLeft' && index > 0) {
|
|
||||||
focusPrev(index);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (event.key === 'ArrowRight' && index < pinLength - 1) {
|
|
||||||
focusNext(index);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!/^\d$/.test(event.key) && event.key !== 'Backspace') {
|
|
||||||
event.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
let pincodeFormElement = $state<HTMLFormElement | null>(null);
|
|
||||||
let hasPincode = $state(false);
|
let hasPincode = $state(false);
|
||||||
let currentPincode = $state('');
|
let currentPincode = $state('');
|
||||||
let newPincode = $state('');
|
let newPincode = $state('');
|
||||||
|
@ -99,13 +98,12 @@
|
||||||
currentPincode = '';
|
currentPincode = '';
|
||||||
newPincode = '';
|
newPincode = '';
|
||||||
confirmPincode = '';
|
confirmPincode = '';
|
||||||
pincodeFormElement?.reset();
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="my-4">
|
<section class="my-4">
|
||||||
<div in:fade={{ duration: 200 }}>
|
<div in:fade={{ duration: 200 }}>
|
||||||
<form bind:this={pincodeFormElement} autocomplete="off" onsubmit={onSubmit} class="mt-6">
|
<form autocomplete="off" onsubmit={onSubmit} class="mt-6">
|
||||||
<div class="flex flex-col gap-6 place-items-center place-content-center">
|
<div class="flex flex-col gap-6 place-items-center place-content-center">
|
||||||
{#if hasPincode}
|
{#if hasPincode}
|
||||||
<p class="text-dark">Change PIN code</p>
|
<p class="text-dark">Change PIN code</p>
|
||||||
|
@ -127,7 +125,10 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-end">
|
<div class="flex justify-end gap-2 mt-4">
|
||||||
|
<Button shape="round" color="secondary" type="button" size="small" onclick={resetForm}>
|
||||||
|
{$t('clear')}
|
||||||
|
</Button>
|
||||||
<Button shape="round" type="submit" size="small" loading={isLoading} disabled={!canSubmit}>
|
<Button shape="round" type="submit" size="small" loading={isLoading} disabled={!canSubmit}>
|
||||||
{hasPincode ? $t('save') : $t('create_pincode')}
|
{hasPincode ? $t('save') : $t('create_pincode')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
|
|
||||||
import { getPartners, PartnerDirection, searchUsers, type UserResponseDto } from '@immich/sdk';
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { t } from 'svelte-i18n';
|
|
||||||
import UserAvatar from '../shared-components/user-avatar.svelte';
|
|
||||||
import { Button } from '@immich/ui';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
user: UserResponseDto;
|
|
||||||
onClose: () => void;
|
|
||||||
onAddUsers: (users: UserResponseDto[]) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { user, onClose, onAddUsers }: Props = $props();
|
|
||||||
|
|
||||||
let availableUsers: UserResponseDto[] = $state([]);
|
|
||||||
let selectedUsers: UserResponseDto[] = $state([]);
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
let users = await searchUsers();
|
|
||||||
|
|
||||||
// remove current user
|
|
||||||
users = users.filter((_user) => _user.id !== user.id);
|
|
||||||
|
|
||||||
// exclude partners from the list of users available for selection
|
|
||||||
const partners = await getPartners({ direction: PartnerDirection.SharedBy });
|
|
||||||
const partnerIds = new Set(partners.map((partner) => partner.id));
|
|
||||||
availableUsers = users.filter((user) => !partnerIds.has(user.id));
|
|
||||||
});
|
|
||||||
|
|
||||||
const selectUser = (user: UserResponseDto) => {
|
|
||||||
selectedUsers = selectedUsers.includes(user)
|
|
||||||
? selectedUsers.filter((selectedUser) => selectedUser.id !== user.id)
|
|
||||||
: [...selectedUsers, user];
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<FullScreenModal title={$t('add_partner')} showLogo {onClose}>
|
|
||||||
<div class="immich-scrollbar max-h-[300px] overflow-y-auto">
|
|
||||||
{#if availableUsers.length > 0}
|
|
||||||
{#each availableUsers as user (user.id)}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onclick={() => selectUser(user)}
|
|
||||||
class="flex w-full place-items-center gap-4 px-5 py-4 transition-all hover:bg-gray-200 dark:hover:bg-gray-700 rounded-xl"
|
|
||||||
>
|
|
||||||
{#if selectedUsers.includes(user)}
|
|
||||||
<span
|
|
||||||
class="flex h-12 w-12 place-content-center place-items-center rounded-full border bg-immich-primary text-3xl text-white dark:border-immich-dark-gray dark:bg-immich-dark-primary dark:text-immich-dark-bg"
|
|
||||||
>✓</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<UserAvatar {user} size="lg" />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="text-start">
|
|
||||||
<p class="text-immich-fg dark:text-immich-dark-fg">
|
|
||||||
{user.name}
|
|
||||||
</p>
|
|
||||||
<p class="text-xs">
|
|
||||||
{user.email}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
{/each}
|
|
||||||
{:else}
|
|
||||||
<p class="py-5 text-sm">
|
|
||||||
{$t('photo_shared_all_users')}
|
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if selectedUsers.length > 0}
|
|
||||||
<div class="pt-5">
|
|
||||||
<Button shape="round" fullWidth onclick={() => onAddUsers(selectedUsers)}>{$t('add')}</Button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</FullScreenModal>
|
|
|
@ -2,6 +2,8 @@
|
||||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||||
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
||||||
import UserAvatar from '$lib/components/shared-components/user-avatar.svelte';
|
import UserAvatar from '$lib/components/shared-components/user-avatar.svelte';
|
||||||
|
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||||
|
import PartnerSelectionModal from '$lib/modals/PartnerSelectionModal.svelte';
|
||||||
import {
|
import {
|
||||||
createPartner,
|
createPartner,
|
||||||
getPartners,
|
getPartners,
|
||||||
|
@ -18,7 +20,6 @@
|
||||||
import { handleError } from '../../utils/handle-error';
|
import { handleError } from '../../utils/handle-error';
|
||||||
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||||
import Icon from '../elements/icon.svelte';
|
import Icon from '../elements/icon.svelte';
|
||||||
import PartnerSelectionModal from './partner-selection-modal.svelte';
|
|
||||||
|
|
||||||
interface PartnerSharing {
|
interface PartnerSharing {
|
||||||
user: UserResponseDto;
|
user: UserResponseDto;
|
||||||
|
@ -33,8 +34,6 @@
|
||||||
|
|
||||||
let { user }: Props = $props();
|
let { user }: Props = $props();
|
||||||
|
|
||||||
let createPartnerFlag = $state(false);
|
|
||||||
// let removePartnerDto: PartnerResponseDto | null = null;
|
|
||||||
let partners: Array<PartnerSharing> = $state([]);
|
let partners: Array<PartnerSharing> = $state([]);
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
@ -99,14 +98,19 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCreatePartners = async (users: UserResponseDto[]) => {
|
const handleCreatePartners = async () => {
|
||||||
|
const users = await modalManager.show(PartnerSelectionModal, { user });
|
||||||
|
|
||||||
|
if (!users) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
await createPartner({ id: user.id });
|
await createPartner({ id: user.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
await refreshPartners();
|
await refreshPartners();
|
||||||
createPartnerFlag = false;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, $t('errors.unable_to_add_partners'));
|
handleError(error, $t('errors.unable_to_add_partners'));
|
||||||
}
|
}
|
||||||
|
@ -189,10 +193,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="flex justify-end mt-5">
|
<div class="flex justify-end mt-5">
|
||||||
<Button shape="round" size="small" onclick={() => (createPartnerFlag = true)}>{$t('add_partner')}</Button>
|
<Button shape="round" size="small" onclick={() => handleCreatePartners()}>{$t('add_partner')}</Button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{#if createPartnerFlag}
|
|
||||||
<PartnerSelectionModal {user} onClose={() => (createPartnerFlag = false)} onAddUsers={handleCreatePartners} />
|
|
||||||
{/if}
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||||
|
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||||
|
import ApiKeyModal from '$lib/modals/ApiKeyModal.svelte';
|
||||||
|
import ApiKeySecretModal from '$lib/modals/ApiKeySecretModal.svelte';
|
||||||
import { locale } from '$lib/stores/preferences.store';
|
import { locale } from '$lib/stores/preferences.store';
|
||||||
import {
|
import {
|
||||||
createApiKey,
|
createApiKey,
|
||||||
|
@ -15,8 +18,6 @@
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { handleError } from '../../utils/handle-error';
|
import { handleError } from '../../utils/handle-error';
|
||||||
import APIKeyForm from '../forms/api-key-form.svelte';
|
|
||||||
import APIKeySecret from '../forms/api-key-secret.svelte';
|
|
||||||
import { notificationController, NotificationType } from '../shared-components/notification/notification';
|
import { notificationController, NotificationType } from '../shared-components/notification/notification';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -25,10 +26,6 @@
|
||||||
|
|
||||||
let { keys = $bindable() }: Props = $props();
|
let { keys = $bindable() }: Props = $props();
|
||||||
|
|
||||||
let newKey: { name: string } | null = $state(null);
|
|
||||||
let editKey: ApiKeyResponseDto | null = $state(null);
|
|
||||||
let secret = $state('');
|
|
||||||
|
|
||||||
const format: Intl.DateTimeFormatOptions = {
|
const format: Intl.DateTimeFormatOptions = {
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
|
@ -39,30 +36,46 @@
|
||||||
keys = await getApiKeys();
|
keys = await getApiKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCreate = async ({ name }: { name: string }) => {
|
const handleCreate = async () => {
|
||||||
try {
|
const result = await modalManager.show(ApiKeyModal, {
|
||||||
const data = await createApiKey({
|
title: $t('new_api_key'),
|
||||||
apiKeyCreateDto: {
|
apiKey: { name: 'API Key' },
|
||||||
name,
|
submitText: $t('create'),
|
||||||
permissions: [Permission.All],
|
});
|
||||||
},
|
|
||||||
});
|
|
||||||
secret = data.secret;
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error, $t('errors.unable_to_create_api_key'));
|
|
||||||
} finally {
|
|
||||||
await refreshKeys();
|
|
||||||
newKey = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUpdate = async (detail: Partial<ApiKeyResponseDto>) => {
|
if (!result) {
|
||||||
if (!editKey || !detail.name) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await updateApiKey({ id: editKey.id, apiKeyUpdateDto: { name: detail.name } });
|
const { secret } = await createApiKey({
|
||||||
|
apiKeyCreateDto: {
|
||||||
|
name: result.name,
|
||||||
|
permissions: [Permission.All],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await modalManager.show(ApiKeySecretModal, { secret });
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, $t('errors.unable_to_create_api_key'));
|
||||||
|
} finally {
|
||||||
|
await refreshKeys();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleUpdate = async (key: ApiKeyResponseDto) => {
|
||||||
|
const result = await modalManager.show(ApiKeyModal, {
|
||||||
|
title: $t('api_key'),
|
||||||
|
submitText: $t('save'),
|
||||||
|
apiKey: key,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await updateApiKey({ id: key.id, apiKeyUpdateDto: { name: result.name } });
|
||||||
notificationController.show({
|
notificationController.show({
|
||||||
message: $t('saved_api_key'),
|
message: $t('saved_api_key'),
|
||||||
type: NotificationType.Info,
|
type: NotificationType.Info,
|
||||||
|
@ -71,7 +84,6 @@
|
||||||
handleError(error, $t('errors.unable_to_save_api_key'));
|
handleError(error, $t('errors.unable_to_save_api_key'));
|
||||||
} finally {
|
} finally {
|
||||||
await refreshKeys();
|
await refreshKeys();
|
||||||
editKey = null;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,34 +107,10 @@
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if newKey}
|
|
||||||
<APIKeyForm
|
|
||||||
title={$t('new_api_key')}
|
|
||||||
submitText={$t('create')}
|
|
||||||
apiKey={newKey}
|
|
||||||
onSubmit={(key) => handleCreate(key)}
|
|
||||||
onCancel={() => (newKey = null)}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if secret}
|
|
||||||
<APIKeySecret {secret} onDone={() => (secret = '')} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if editKey}
|
|
||||||
<APIKeyForm
|
|
||||||
title={$t('api_key')}
|
|
||||||
submitText={$t('save')}
|
|
||||||
apiKey={editKey}
|
|
||||||
onSubmit={(key) => handleUpdate(key)}
|
|
||||||
onCancel={() => (editKey = null)}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<section class="my-4">
|
<section class="my-4">
|
||||||
<div class="flex flex-col gap-2" in:fade={{ duration: 500 }}>
|
<div class="flex flex-col gap-2" in:fade={{ duration: 500 }}>
|
||||||
<div class="mb-2 flex justify-end">
|
<div class="mb-2 flex justify-end">
|
||||||
<Button shape="round" size="small" onclick={() => (newKey = { name: $t('api_key') })}>{$t('new_api_key')}</Button>
|
<Button shape="round" size="small" onclick={() => handleCreate()}>{$t('new_api_key')}</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if keys.length > 0}
|
{#if keys.length > 0}
|
||||||
|
@ -153,7 +141,7 @@
|
||||||
icon={mdiPencilOutline}
|
icon={mdiPencilOutline}
|
||||||
title={$t('edit_key')}
|
title={$t('edit_key')}
|
||||||
size="16"
|
size="16"
|
||||||
onclick={() => (editKey = key)}
|
onclick={() => handleUpdate(key)}
|
||||||
/>
|
/>
|
||||||
<CircleIconButton
|
<CircleIconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
import ConfirmDialog from '$lib/components/shared-components/dialog/confirm-dialog.svelte';
|
import ConfirmDialog from '$lib/components/shared-components/dialog/confirm-dialog.svelte';
|
||||||
import { mount, unmount, type Component, type ComponentProps } from 'svelte';
|
import { mount, unmount, type Component, type ComponentProps } from 'svelte';
|
||||||
|
|
||||||
type OnCloseData<T> = T extends { onClose: (data: infer R) => void | Promise<void> } ? R : never;
|
type OnCloseData<T> = T extends { onClose: (data?: infer R) => void } ? R : never;
|
||||||
|
type ExtendsEmptyObject<T> = keyof T extends never ? Record<string, never> : T;
|
||||||
|
|
||||||
class ModalManager {
|
class ModalManager {
|
||||||
open<T = { onClose: (data: unknown) => void }, K = OnCloseData<T>>(
|
show<T extends object>(Component: Component<T>, props: ExtendsEmptyObject<Omit<T, 'onClose'>>) {
|
||||||
Component: Component<{ onClose: T }>,
|
return this.open(Component, props).onClose;
|
||||||
props?: Record<string, never>,
|
}
|
||||||
): Promise<K>;
|
|
||||||
open<T extends object, K = OnCloseData<T>>(Component: Component<T>, props: Omit<T, 'onClose'>): Promise<K>;
|
|
||||||
open<T extends object, K = OnCloseData<T>>(Component: Component<T>, props?: Omit<T, 'onClose'>) {
|
|
||||||
return new Promise<K>((resolve) => {
|
|
||||||
let modal: object = {};
|
|
||||||
|
|
||||||
const onClose = async (data: K) => {
|
open<T extends object, K = OnCloseData<T>>(Component: Component<T>, props: ExtendsEmptyObject<Omit<T, 'onClose'>>) {
|
||||||
|
let modal: object = {};
|
||||||
|
let onClose: () => Promise<void>;
|
||||||
|
|
||||||
|
const deferred = new Promise<K | undefined>((resolve) => {
|
||||||
|
onClose = async (data?: K) => {
|
||||||
await unmount(modal);
|
await unmount(modal);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
};
|
};
|
||||||
|
@ -21,15 +22,20 @@ class ModalManager {
|
||||||
modal = mount(Component, {
|
modal = mount(Component, {
|
||||||
target: document.body,
|
target: document.body,
|
||||||
props: {
|
props: {
|
||||||
...((props ?? {}) as T),
|
...(props as T),
|
||||||
onClose,
|
onClose,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
onClose: deferred,
|
||||||
|
close: () => onClose(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
openDialog(options: Omit<ComponentProps<typeof ConfirmDialog>, 'onClose'>) {
|
openDialog(options: Omit<ComponentProps<typeof ConfirmDialog>, 'onClose'>) {
|
||||||
return this.open(ConfirmDialog, options);
|
return this.show(ConfirmDialog, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
web/src/lib/modals/ApiKeyModal.svelte
Normal file
53
web/src/lib/modals/ApiKeyModal.svelte
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType,
|
||||||
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
|
import { Button, Modal, ModalBody, ModalFooter } from '@immich/ui';
|
||||||
|
import { mdiKeyVariant } from '@mdi/js';
|
||||||
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
apiKey: { name: string };
|
||||||
|
title: string;
|
||||||
|
cancelText?: string;
|
||||||
|
submitText?: string;
|
||||||
|
onClose: (apiKey?: { name: string }) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { apiKey = $bindable(), title, cancelText = $t('cancel'), submitText = $t('save'), onClose }: Props = $props();
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (apiKey.name) {
|
||||||
|
onClose({ name: apiKey.name });
|
||||||
|
} else {
|
||||||
|
notificationController.show({
|
||||||
|
message: $t('api_key_empty'),
|
||||||
|
type: NotificationType.Warning,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onsubmit = (event: Event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
handleSubmit();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal {title} icon={mdiKeyVariant} {onClose} size="small">
|
||||||
|
<ModalBody>
|
||||||
|
<form {onsubmit} autocomplete="off" id="api-key-form">
|
||||||
|
<div class="mb-4 flex flex-col gap-2">
|
||||||
|
<label class="immich-form-label" for="name">{$t('name')}</label>
|
||||||
|
<input class="immich-form-input" id="name" name="name" type="text" bind:value={apiKey.name} />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<div class="flex gap-3 w-full">
|
||||||
|
<Button shape="round" color="secondary" fullWidth onclick={() => onClose()}>{cancelText}</Button>
|
||||||
|
<Button shape="round" type="submit" fullWidth form="api-key-form">{submitText}</Button>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</Modal>
|
35
web/src/lib/modals/ApiKeySecretModal.svelte
Normal file
35
web/src/lib/modals/ApiKeySecretModal.svelte
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { copyToClipboard } from '$lib/utils';
|
||||||
|
import { Button, Modal, ModalBody, ModalFooter } from '@immich/ui';
|
||||||
|
import { mdiKeyVariant } from '@mdi/js';
|
||||||
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
secret?: string;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { secret = '', onClose }: Props = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal title={$t('api_key')} icon={mdiKeyVariant} {onClose} size="small">
|
||||||
|
<ModalBody>
|
||||||
|
<div class="text-immich-primary dark:text-immich-dark-primary">
|
||||||
|
<p class="text-sm dark:text-immich-dark-fg">
|
||||||
|
{$t('api_key_description')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-4 flex flex-col gap-2">
|
||||||
|
<!-- <label class="immich-form-label" for="secret">{ $t("api_key") }</label> -->
|
||||||
|
<textarea class="immich-form-input" id="secret" name="secret" readonly={true} value={secret}></textarea>
|
||||||
|
</div>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<div class="flex gap-3 w-full">
|
||||||
|
<Button shape="round" onclick={() => copyToClipboard(secret)} fullWidth>{$t('copy_to_clipboard')}</Button>
|
||||||
|
<Button shape="round" onclick={onClose} fullWidth>{$t('done')}</Button>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</Modal>
|
|
@ -1,11 +1,10 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
|
|
||||||
import Portal from '$lib/components/shared-components/portal/portal.svelte';
|
|
||||||
import { type ServerAboutResponseDto } from '@immich/sdk';
|
|
||||||
import { t } from 'svelte-i18n';
|
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
|
||||||
import { mdiBugOutline, mdiFaceAgent, mdiGit, mdiGithub, mdiInformationOutline } from '@mdi/js';
|
|
||||||
import { discordPath, discordViewBox } from '$lib/assets/svg-paths';
|
import { discordPath, discordViewBox } from '$lib/assets/svg-paths';
|
||||||
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
|
import { type ServerAboutResponseDto } from '@immich/sdk';
|
||||||
|
import { Modal, ModalBody } from '@immich/ui';
|
||||||
|
import { mdiBugOutline, mdiFaceAgent, mdiGit, mdiGithub, mdiInformationOutline } from '@mdi/js';
|
||||||
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
@ -15,8 +14,8 @@
|
||||||
let { onClose, info }: Props = $props();
|
let { onClose, info }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Portal>
|
<Modal title={$t('support_and_feedback')} {onClose} size="small">
|
||||||
<FullScreenModal title={$t('support_and_feedback')} {onClose}>
|
<ModalBody>
|
||||||
<p>{$t('official_immich_resources')}</p>
|
<p>{$t('official_immich_resources')}</p>
|
||||||
<div class="flex flex-col sm:grid sm:grid-cols-2 gap-2 mt-5">
|
<div class="flex flex-col sm:grid sm:grid-cols-2 gap-2 mt-5">
|
||||||
<div>
|
<div>
|
||||||
|
@ -130,5 +129,5 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</FullScreenModal>
|
</ModalBody>
|
||||||
</Portal>
|
</Modal>
|
135
web/src/lib/modals/MapSettingsModal.svelte
Normal file
135
web/src/lib/modals/MapSettingsModal.svelte
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
||||||
|
import type { MapSettings } from '$lib/stores/preferences.store';
|
||||||
|
import { Button, Field, Modal, ModalBody, ModalFooter, Stack, Switch } from '@immich/ui';
|
||||||
|
import { Duration } from 'luxon';
|
||||||
|
import { t } from 'svelte-i18n';
|
||||||
|
import { fly } from 'svelte/transition';
|
||||||
|
import DateInput from '../components/elements/date-input.svelte';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
settings: MapSettings;
|
||||||
|
onClose: (settings?: MapSettings) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { settings: initialValues, onClose }: Props = $props();
|
||||||
|
let settings = $state(initialValues);
|
||||||
|
|
||||||
|
let customDateRange = $state(!!settings.dateAfter || !!settings.dateBefore);
|
||||||
|
|
||||||
|
const onsubmit = (event: Event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
onClose(settings);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal title={$t('map_settings')} {onClose} size="small">
|
||||||
|
<ModalBody>
|
||||||
|
<form {onsubmit} id="map-settings-form">
|
||||||
|
<Stack gap={4}>
|
||||||
|
<Field label={$t('allow_dark_mode')}>
|
||||||
|
<Switch bind:checked={settings.allowDarkMode} />
|
||||||
|
</Field>
|
||||||
|
<Field label={$t('only_favorites')}>
|
||||||
|
<Switch bind:checked={settings.onlyFavorites} />
|
||||||
|
</Field>
|
||||||
|
<Field label={$t('include_archived')}>
|
||||||
|
<Switch bind:checked={settings.includeArchived} />
|
||||||
|
</Field>
|
||||||
|
<Field label={$t('include_shared_partner_assets')}>
|
||||||
|
<Switch bind:checked={settings.withPartners} />
|
||||||
|
</Field>
|
||||||
|
<Field label={$t('include_shared_albums')}>
|
||||||
|
<Switch bind:checked={settings.withSharedAlbums} />
|
||||||
|
</Field>
|
||||||
|
|
||||||
|
{#if customDateRange}
|
||||||
|
<div in:fly={{ y: 10, duration: 200 }} class="flex flex-col gap-4">
|
||||||
|
<div class="flex items-center justify-between gap-8">
|
||||||
|
<label class="immich-form-label shrink-0 text-sm" for="date-after">{$t('date_after')}</label>
|
||||||
|
<DateInput
|
||||||
|
class="immich-form-input w-40"
|
||||||
|
type="date"
|
||||||
|
id="date-after"
|
||||||
|
max={settings.dateBefore}
|
||||||
|
bind:value={settings.dateAfter}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-between gap-8">
|
||||||
|
<label class="immich-form-label shrink-0 text-sm" for="date-before">{$t('date_before')}</label>
|
||||||
|
<DateInput class="immich-form-input w-40" type="date" id="date-before" bind:value={settings.dateBefore} />
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-center text-xs">
|
||||||
|
<Button
|
||||||
|
color="primary"
|
||||||
|
size="small"
|
||||||
|
variant="ghost"
|
||||||
|
onclick={() => {
|
||||||
|
customDateRange = false;
|
||||||
|
settings.dateAfter = '';
|
||||||
|
settings.dateBefore = '';
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{$t('remove_custom_date_range')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div in:fly={{ y: -10, duration: 200 }} class="flex flex-col gap-1">
|
||||||
|
<SettingSelect
|
||||||
|
label={$t('date_range')}
|
||||||
|
name="date-range"
|
||||||
|
bind:value={settings.relativeDate}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
value: '',
|
||||||
|
text: $t('all'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Duration.fromObject({ hours: 24 }).toISO() || '',
|
||||||
|
text: $t('past_durations.hours', { values: { hours: 24 } }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Duration.fromObject({ days: 7 }).toISO() || '',
|
||||||
|
text: $t('past_durations.days', { values: { days: 7 } }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Duration.fromObject({ days: 30 }).toISO() || '',
|
||||||
|
text: $t('past_durations.days', { values: { days: 30 } }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Duration.fromObject({ years: 1 }).toISO() || '',
|
||||||
|
text: $t('past_durations.years', { values: { years: 1 } }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Duration.fromObject({ years: 3 }).toISO() || '',
|
||||||
|
text: $t('past_durations.years', { values: { years: 3 } }),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<div class="text-xs">
|
||||||
|
<Button
|
||||||
|
color="primary"
|
||||||
|
size="small"
|
||||||
|
variant="ghost"
|
||||||
|
onclick={() => {
|
||||||
|
customDateRange = true;
|
||||||
|
settings.relativeDate = '';
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{$t('use_custom_date_range')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</Stack>
|
||||||
|
</form>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<div class="flex gap-3 w-full">
|
||||||
|
<Button color="secondary" shape="round" fullWidth onclick={() => onClose()}>{$t('cancel')}</Button>
|
||||||
|
<Button type="submit" shape="round" fullWidth form="map-settings-form">{$t('save')}</Button>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</Modal>
|
79
web/src/lib/modals/PartnerSelectionModal.svelte
Normal file
79
web/src/lib/modals/PartnerSelectionModal.svelte
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import UserAvatar from '$lib/components/shared-components/user-avatar.svelte';
|
||||||
|
import { getPartners, PartnerDirection, searchUsers, type UserResponseDto } from '@immich/sdk';
|
||||||
|
import { Button, Modal, ModalBody, ModalFooter } from '@immich/ui';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
user: UserResponseDto;
|
||||||
|
onClose: (users?: UserResponseDto[]) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { user, onClose }: Props = $props();
|
||||||
|
|
||||||
|
let availableUsers: UserResponseDto[] = $state([]);
|
||||||
|
let selectedUsers: UserResponseDto[] = $state([]);
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
let users = await searchUsers();
|
||||||
|
|
||||||
|
// remove current user
|
||||||
|
users = users.filter((_user) => _user.id !== user.id);
|
||||||
|
|
||||||
|
// exclude partners from the list of users available for selection
|
||||||
|
const partners = await getPartners({ direction: PartnerDirection.SharedBy });
|
||||||
|
const partnerIds = new Set(partners.map((partner) => partner.id));
|
||||||
|
availableUsers = users.filter((user) => !partnerIds.has(user.id));
|
||||||
|
});
|
||||||
|
|
||||||
|
const selectUser = (user: UserResponseDto) => {
|
||||||
|
selectedUsers = selectedUsers.includes(user)
|
||||||
|
? selectedUsers.filter((selectedUser) => selectedUser.id !== user.id)
|
||||||
|
: [...selectedUsers, user];
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal title={$t('add_partner')} {onClose} size="small">
|
||||||
|
<ModalBody>
|
||||||
|
<div class="immich-scrollbar max-h-[300px] overflow-y-auto">
|
||||||
|
{#if availableUsers.length > 0}
|
||||||
|
{#each availableUsers as user (user.id)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick={() => selectUser(user)}
|
||||||
|
class="flex w-full place-items-center gap-4 px-5 py-4 transition-all hover:bg-gray-200 dark:hover:bg-gray-700 rounded-xl"
|
||||||
|
>
|
||||||
|
{#if selectedUsers.includes(user)}
|
||||||
|
<span
|
||||||
|
class="flex h-12 w-12 place-content-center place-items-center rounded-full border bg-immich-primary text-3xl text-white dark:border-immich-dark-gray dark:bg-immich-dark-primary dark:text-immich-dark-bg"
|
||||||
|
>✓</span
|
||||||
|
>
|
||||||
|
{:else}
|
||||||
|
<UserAvatar {user} size="lg" />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="text-start">
|
||||||
|
<p class="text-immich-fg dark:text-immich-dark-fg">
|
||||||
|
{user.name}
|
||||||
|
</p>
|
||||||
|
<p class="text-xs">
|
||||||
|
{user.email}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
{:else}
|
||||||
|
<p class="py-5 text-sm">
|
||||||
|
{$t('photo_shared_all_users')}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
{#if selectedUsers.length > 0}
|
||||||
|
<Button shape="round" fullWidth onclick={() => onClose(selectedUsers)}>{$t('add')}</Button>
|
||||||
|
{/if}
|
||||||
|
</ModalFooter>
|
||||||
|
</div>
|
||||||
|
</ModalBody>
|
||||||
|
</Modal>
|
|
@ -4,16 +4,19 @@
|
||||||
import { userInteraction } from '$lib/stores/user.svelte';
|
import { userInteraction } from '$lib/stores/user.svelte';
|
||||||
import { ByteUnit, convertFromBytes, convertToBytes } from '$lib/utils/byte-units';
|
import { ByteUnit, convertFromBytes, convertToBytes } from '$lib/utils/byte-units';
|
||||||
import { handleError } from '$lib/utils/handle-error';
|
import { handleError } from '$lib/utils/handle-error';
|
||||||
import { updateUserAdmin, type UserAdminResponseDto } from '@immich/sdk';
|
import { resetPincode, updateUserAdmin, type UserAdminResponseDto } from '@immich/sdk';
|
||||||
import { Button, Modal, ModalBody, ModalFooter } from '@immich/ui';
|
import { Button, Modal, ModalBody, ModalFooter } from '@immich/ui';
|
||||||
import { mdiAccountEditOutline } from '@mdi/js';
|
import { mdiAccountEditOutline, mdiLockSmart, mdiOnepassword } from '@mdi/js';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
user: UserAdminResponseDto;
|
user: UserAdminResponseDto;
|
||||||
canResetPassword?: boolean;
|
canResetPassword?: boolean;
|
||||||
onClose: (
|
onClose: (
|
||||||
data?: { action: 'update'; data: UserAdminResponseDto } | { action: 'resetPassword'; data: string },
|
data?:
|
||||||
|
| { action: 'update'; data: UserAdminResponseDto }
|
||||||
|
| { action: 'resetPassword'; data: string }
|
||||||
|
| { action: 'resetPincode' },
|
||||||
) => void;
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +79,28 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resetUserPincode = async () => {
|
||||||
|
const isConfirmed = await modalManager.openDialog({
|
||||||
|
prompt: $t('admin.confirm_user_pincode_reset', { values: { user: user.name } }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isConfirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await resetPincode({
|
||||||
|
resetPincodeDto: {
|
||||||
|
userId: user.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
onClose({ action: 'resetPincode' });
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, $t('errors.unable_to_reset_pincode'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// TODO move password reset server-side
|
// TODO move password reset server-side
|
||||||
function generatePassword(length: number = 16) {
|
function generatePassword(length: number = 16) {
|
||||||
let generatedPassword = '';
|
let generatedPassword = '';
|
||||||
|
@ -151,13 +176,34 @@
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<div class="flex gap-3 w-full">
|
<div class="w-full">
|
||||||
{#if canResetPassword}
|
<div class="flex gap-3 w-full">
|
||||||
<Button shape="round" color="warning" variant="filled" fullWidth onclick={resetPassword}
|
{#if canResetPassword}
|
||||||
>{$t('reset_password')}</Button
|
<Button
|
||||||
|
shape="round"
|
||||||
|
color="warning"
|
||||||
|
variant="filled"
|
||||||
|
fullWidth
|
||||||
|
onclick={resetPassword}
|
||||||
|
leadingIcon={mdiOnepassword}
|
||||||
|
>
|
||||||
|
{$t('reset_password')}</Button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<Button
|
||||||
|
shape="round"
|
||||||
|
color="warning"
|
||||||
|
variant="filled"
|
||||||
|
fullWidth
|
||||||
|
onclick={resetUserPincode}
|
||||||
|
leadingIcon={mdiLockSmart}>{$t('reset_pincode')}</Button
|
||||||
>
|
>
|
||||||
{/if}
|
</div>
|
||||||
<Button type="submit" shape="round" fullWidth form="edit-user-form">{$t('confirm')}</Button>
|
|
||||||
|
<div class="w-full mt-4">
|
||||||
|
<Button type="submit" shape="round" fullWidth form="edit-user-form">{$t('confirm')}</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -3,21 +3,15 @@
|
||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||||
import MapSettingsModal from '$lib/components/map-page/map-settings-modal.svelte';
|
|
||||||
import Map from '$lib/components/shared-components/map/map.svelte';
|
import Map from '$lib/components/shared-components/map/map.svelte';
|
||||||
import Portal from '$lib/components/shared-components/portal/portal.svelte';
|
import Portal from '$lib/components/shared-components/portal/portal.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
|
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
|
||||||
import type { MapSettings } from '$lib/stores/preferences.store';
|
|
||||||
import { mapSettings } from '$lib/stores/preferences.store';
|
|
||||||
import { featureFlags } from '$lib/stores/server-config.store';
|
import { featureFlags } from '$lib/stores/server-config.store';
|
||||||
import { getMapMarkers, type MapMarkerResponseDto } from '@immich/sdk';
|
|
||||||
import { isEqual } from 'lodash-es';
|
|
||||||
import { DateTime, Duration } from 'luxon';
|
|
||||||
import { onDestroy, onMount } from 'svelte';
|
|
||||||
import type { PageData } from './$types';
|
|
||||||
import { handlePromiseError } from '$lib/utils';
|
import { handlePromiseError } from '$lib/utils';
|
||||||
import { navigate } from '$lib/utils/navigation';
|
import { navigate } from '$lib/utils/navigation';
|
||||||
|
import { onDestroy } from 'svelte';
|
||||||
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: PageData;
|
data: PageData;
|
||||||
|
@ -27,18 +21,10 @@
|
||||||
|
|
||||||
let { isViewing: showAssetViewer, asset: viewingAsset, setAssetId } = assetViewingStore;
|
let { isViewing: showAssetViewer, asset: viewingAsset, setAssetId } = assetViewingStore;
|
||||||
|
|
||||||
let abortController: AbortController;
|
|
||||||
let mapMarkers: MapMarkerResponseDto[] = $state([]);
|
|
||||||
let viewingAssets: string[] = $state([]);
|
let viewingAssets: string[] = $state([]);
|
||||||
let viewingAssetCursor = 0;
|
let viewingAssetCursor = 0;
|
||||||
let showSettingsModal = $state(false);
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
mapMarkers = await loadMapMarkers();
|
|
||||||
});
|
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
abortController?.abort();
|
|
||||||
assetViewingStore.showAssetViewer(false);
|
assetViewingStore.showAssetViewer(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -47,55 +33,6 @@
|
||||||
handlePromiseError(goto(AppRoute.PHOTOS));
|
handlePromiseError(goto(AppRoute.PHOTOS));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const omit = (obj: MapSettings, key: string) => {
|
|
||||||
return Object.fromEntries(Object.entries(obj).filter(([k]) => k !== key));
|
|
||||||
};
|
|
||||||
|
|
||||||
async function loadMapMarkers() {
|
|
||||||
if (abortController) {
|
|
||||||
abortController.abort();
|
|
||||||
}
|
|
||||||
abortController = new AbortController();
|
|
||||||
|
|
||||||
const { includeArchived, onlyFavorites, withPartners, withSharedAlbums } = $mapSettings;
|
|
||||||
const { fileCreatedAfter, fileCreatedBefore } = getFileCreatedDates();
|
|
||||||
|
|
||||||
return await getMapMarkers(
|
|
||||||
{
|
|
||||||
isArchived: includeArchived && undefined,
|
|
||||||
isFavorite: onlyFavorites || undefined,
|
|
||||||
fileCreatedAfter: fileCreatedAfter || undefined,
|
|
||||||
fileCreatedBefore,
|
|
||||||
withPartners: withPartners || undefined,
|
|
||||||
withSharedAlbums: withSharedAlbums || undefined,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
signal: abortController.signal,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileCreatedDates() {
|
|
||||||
const { relativeDate, dateAfter, dateBefore } = $mapSettings;
|
|
||||||
|
|
||||||
if (relativeDate) {
|
|
||||||
const duration = Duration.fromISO(relativeDate);
|
|
||||||
return {
|
|
||||||
fileCreatedAfter: duration.isValid ? DateTime.now().minus(duration).toISO() : undefined,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
fileCreatedAfter: dateAfter ? new Date(dateAfter).toISOString() : undefined,
|
|
||||||
fileCreatedBefore: dateBefore ? new Date(dateBefore).toISOString() : undefined,
|
|
||||||
};
|
|
||||||
} catch {
|
|
||||||
$mapSettings.dateAfter = '';
|
|
||||||
$mapSettings.dateBefore = '';
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onViewAssets(assetIds: string[]) {
|
async function onViewAssets(assetIds: string[]) {
|
||||||
viewingAssets = assetIds;
|
viewingAssets = assetIds;
|
||||||
|
@ -135,7 +72,7 @@
|
||||||
{#if $featureFlags.loaded && $featureFlags.map}
|
{#if $featureFlags.loaded && $featureFlags.map}
|
||||||
<UserPageLayout title={data.meta.title}>
|
<UserPageLayout title={data.meta.title}>
|
||||||
<div class="isolate h-full w-full">
|
<div class="isolate h-full w-full">
|
||||||
<Map hash bind:mapMarkers bind:showSettingsModal onSelect={onViewAssets} />
|
<Map hash onSelect={onViewAssets} />
|
||||||
</div>
|
</div>
|
||||||
</UserPageLayout>
|
</UserPageLayout>
|
||||||
<Portal target="body">
|
<Portal target="body">
|
||||||
|
@ -156,20 +93,4 @@
|
||||||
{/await}
|
{/await}
|
||||||
{/if}
|
{/if}
|
||||||
</Portal>
|
</Portal>
|
||||||
|
|
||||||
{#if showSettingsModal}
|
|
||||||
<MapSettingsModal
|
|
||||||
settings={{ ...$mapSettings }}
|
|
||||||
onClose={() => (showSettingsModal = false)}
|
|
||||||
onSave={async (settings) => {
|
|
||||||
const shouldUpdate = !isEqual(omit(settings, 'allowDarkMode'), omit($mapSettings, 'allowDarkMode'));
|
|
||||||
showSettingsModal = false;
|
|
||||||
$mapSettings = settings;
|
|
||||||
|
|
||||||
if (shouldUpdate) {
|
|
||||||
mapMarkers = await loadMapMarkers();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<HStack gap={0}>
|
<HStack gap={0}>
|
||||||
<Button
|
<Button
|
||||||
leadingIcon={mdiPlus}
|
leadingIcon={mdiPlus}
|
||||||
onclick={() => modalManager.open(JobCreateModal)}
|
onclick={() => modalManager.show(JobCreateModal, {})}
|
||||||
size="small"
|
size="small"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
|
|
|
@ -59,33 +59,40 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCreate = async () => {
|
const handleCreate = async () => {
|
||||||
await modalManager.open(UserCreateModal);
|
await modalManager.show(UserCreateModal, {});
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEdit = async (dto: UserAdminResponseDto) => {
|
const handleEdit = async (dto: UserAdminResponseDto) => {
|
||||||
const result = await modalManager.open(UserEditModal, { user: dto, canResetPassword: dto.id !== $user.id });
|
const result = await modalManager.show(UserEditModal, { user: dto, canResetPassword: dto.id !== $user.id });
|
||||||
switch (result?.action) {
|
switch (result?.action) {
|
||||||
case 'resetPassword': {
|
case 'resetPassword': {
|
||||||
await modalManager.open(PasswordResetSuccess, { newPassword: result.data });
|
await modalManager.show(PasswordResetSuccess, { newPassword: result.data });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'update': {
|
case 'update': {
|
||||||
await refresh();
|
await refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'resetPincode': {
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Info,
|
||||||
|
message: $t('pincode_reset_successfully'),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = async (user: UserAdminResponseDto) => {
|
const handleDelete = async (user: UserAdminResponseDto) => {
|
||||||
const result = await modalManager.open(UserDeleteConfirmModal, { user });
|
const result = await modalManager.show(UserDeleteConfirmModal, { user });
|
||||||
if (result) {
|
if (result) {
|
||||||
await refresh();
|
await refresh();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRestore = async (user: UserAdminResponseDto) => {
|
const handleRestore = async (user: UserAdminResponseDto) => {
|
||||||
const result = await modalManager.open(UserRestoreConfirmModal, { user });
|
const result = await modalManager.show(UserRestoreConfirmModal, { user });
|
||||||
if (result) {
|
if (result) {
|
||||||
await refresh();
|
await refresh();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +144,7 @@
|
||||||
{#if !immichUser.deletedAt}
|
{#if !immichUser.deletedAt}
|
||||||
<IconButton
|
<IconButton
|
||||||
shape="round"
|
shape="round"
|
||||||
size="small"
|
size="medium"
|
||||||
icon={mdiPencilOutline}
|
icon={mdiPencilOutline}
|
||||||
title={$t('edit_user')}
|
title={$t('edit_user')}
|
||||||
onclick={() => handleEdit(immichUser)}
|
onclick={() => handleEdit(immichUser)}
|
||||||
|
@ -146,7 +153,7 @@
|
||||||
{#if immichUser.id !== $user.id}
|
{#if immichUser.id !== $user.id}
|
||||||
<IconButton
|
<IconButton
|
||||||
shape="round"
|
shape="round"
|
||||||
size="small"
|
size="medium"
|
||||||
icon={mdiTrashCanOutline}
|
icon={mdiTrashCanOutline}
|
||||||
title={$t('delete_user')}
|
title={$t('delete_user')}
|
||||||
onclick={() => handleDelete(immichUser)}
|
onclick={() => handleDelete(immichUser)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue