From c882b56f82fc74694f63bdbc21a20ff77ed6d33d Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 4 Apr 2020 17:19:34 +0200 Subject: [PATCH] Sync: Download remote files #225 Signed-off-by: Michael Mayer --- assets/resources/examples/fixtures.sql | 2 +- .../dialog/account/p-account-edit-dialog.vue | 12 +- frontend/src/model/account.js | 10 +- frontend/src/pages/settings/accounts.vue | 4 +- internal/api/websocket.go | 2 +- internal/entity/account.go | 72 ++++--- internal/entity/file_sync.go | 8 +- internal/form/account.go | 47 ++--- internal/form/account_search.go | 1 + internal/photoprism/service_workers.go | 4 +- internal/photoprism/share.go | 20 ++ internal/photoprism/sync.go | 198 +++++++++++++++++- internal/query/account.go | 4 + internal/query/file_share.go | 2 +- internal/query/file_sync.go | 29 +++ pkg/fs/fileinfo.go | 9 +- pkg/txt/resources/stopwords.txt | 16 ++ pkg/txt/stopwords.go | 16 ++ 18 files changed, 383 insertions(+), 73 deletions(-) create mode 100644 internal/query/file_sync.go diff --git a/assets/resources/examples/fixtures.sql b/assets/resources/examples/fixtures.sql index c6cf99311..cfd893114 100644 --- a/assets/resources/examples/fixtures.sql +++ b/assets/resources/examples/fixtures.sql @@ -31,4 +31,4 @@ INSERT INTO labels (id, label_uuid, label_slug, label_name, label_priority, labe INSERT INTO labels (id, label_uuid, label_slug, label_name, label_priority, label_favorite) VALUES ('3', '14', 'cow', 'COW', -1, 1); INSERT INTO photos_labels (photo_id, label_id, label_uncertainty, label_source) VALUES ('1', '1', '38', 'image'); INSERT INTO photos_labels (photo_id, label_id, label_uncertainty, label_source) VALUES ('1', '2', '10', 'image'); -INSERT INTO accounts (id, acc_name, acc_owner, acc_url, acc_type, acc_key, acc_user, acc_pass, acc_error, acc_share, acc_sync, retry_limit, share_path, share_size, share_expires, sync_path, sync_interval, sync_upload, sync_download, sync_delete, sync_raw, sync_video, sync_sidecar, sync_start, synced_at, created_at, updated_at, deleted_at) VALUES (1, 'Test Account', 'Admin', 'http://webdav-dummy/', 'webdav', '', 'admin', 'photoprism', null, true, false, 3, '/Photos', null, null, null, null, null, null, null, null, null, null, null, null, '2020-03-06 02:06:51', '2020-03-28 14:06:00', null); +INSERT INTO accounts (id, acc_name, acc_owner, acc_url, acc_type, acc_key, acc_user, acc_pass, acc_error, acc_share, acc_sync, retry_limit, share_path, share_size, share_expires, sync_path, sync_interval, sync_upload, sync_download, sync_raw, sync_video, sync_sidecar, created_at, updated_at, deleted_at) VALUES (1, 'Test Account', 'Admin', 'http://webdav-dummy/', 'webdav', '', 'admin', 'photoprism', null, true, false, 3, '/Photos', null, null, null, null, null, null, null, null, null, '2020-03-06 02:06:51', '2020-03-28 14:06:00', null); diff --git a/frontend/src/dialog/account/p-account-edit-dialog.vue b/frontend/src/dialog/account/p-account-edit-dialog.vue index 94e3fbabb..e6daaa738 100644 --- a/frontend/src/dialog/account/p-account-edit-dialog.vue +++ b/frontend/src/dialog/account/p-account-edit-dialog.vue @@ -154,6 +154,15 @@ v-model="model.SyncDownload" > + + + Promise.resolve(response.data)); } diff --git a/frontend/src/pages/settings/accounts.vue b/frontend/src/pages/settings/accounts.vue index 1271b27d9..4afb33a7e 100644 --- a/frontend/src/pages/settings/accounts.vue +++ b/frontend/src/pages/settings/accounts.vue @@ -30,7 +30,7 @@ sync sync_disabled - {{ formatDate(props.item.SyncedAt) }} + {{ formatDate(props.item.SyncDate) }}