diff --git a/src/frontend/app/ui/gallery/share/share.gallery.component.css b/src/frontend/app/ui/gallery/share/share.gallery.component.css
index 17ea87001..531d09e41 100644
--- a/src/frontend/app/ui/gallery/share/share.gallery.component.css
+++ b/src/frontend/app/ui/gallery/share/share.gallery.component.css
@@ -24,3 +24,12 @@ a.dropdown-item, button.dropdown-item, div.dropdown-item {
a.dropdown-item span, button.dropdown-item span, div.dropdown-item span {
padding-right: 0.8rem;
}
+
+a.list-shares-button {
+ cursor: pointer;
+ color: inherit;
+}
+
+a.list-shares-button:hover {
+ text-decoration: underline;
+}
diff --git a/src/frontend/app/ui/gallery/share/share.gallery.component.html b/src/frontend/app/ui/gallery/share/share.gallery.component.html
index ef3425600..049f37e3d 100644
--- a/src/frontend/app/ui/gallery/share/share.gallery.component.html
+++ b/src/frontend/app/ui/gallery/share/share.gallery.component.html
@@ -28,16 +28,25 @@
Share
class="form-control input-md"
type="text"
readonly
- [disabled]="!shareForm.form.valid"
+ [disabled]="!shareForm.form.valid || !urlValid"
[ngModel]="shareForm.form.valid ? url: invalidSettings">
-
@@ -117,32 +126,39 @@ Share
- 0">
-
-
-
-
- Key |
- Creator |
- Expires |
- |
-
-
-
-
- {{share.sharingKey}} |
- {{share.creator.name}} |
- {{share.expires | date}} |
-
-
-
-
- |
-
-
-
-
+
+
diff --git a/src/frontend/app/ui/gallery/share/share.gallery.component.ts b/src/frontend/app/ui/gallery/share/share.gallery.component.ts
index 705db94b2..89f874ed2 100644
--- a/src/frontend/app/ui/gallery/share/share.gallery.component.ts
+++ b/src/frontend/app/ui/gallery/share/share.gallery.component.ts
@@ -9,6 +9,9 @@ import {NotificationService} from '../../../model/notification.service';
import {BsModalService} from 'ngx-bootstrap/modal';
import {BsModalRef} from 'ngx-bootstrap/modal/bs-modal-ref.service';
import {Subscription} from 'rxjs';
+import {UserRoles} from '../../../../../common/entities/UserDTO';
+import {AuthenticationService} from '../../../model/network/authentication.service';
+import {ClipboardService} from 'ngx-clipboard';
@Component({
selector: 'app-gallery-share',
@@ -19,6 +22,8 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
enabled = true;
@Input() dropDownItem = false;
url = '';
+ urlValid = false;
+ showSharingList = false;
input = {
includeSubfolders: true,
@@ -48,12 +53,18 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
public sharingService: ShareService,
public galleryService: ContentService,
private notification: NotificationService,
- private modalService: BsModalService
+ private modalService: BsModalService,
+ public authService: AuthenticationService,
+ private clipboardService: ClipboardService
) {
this.text.Yes = $localize`Yes`;
this.text.No = $localize`No`;
}
+ public get IsAdmin() {
+ return this.authService.user.value.role > UserRoles.Admin;
+ }
+
ngOnInit(): void {
this.contentSubscription = this.galleryService.content.subscribe(
async (content: ContentWrapper) => {
@@ -112,6 +123,7 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
if (this.sharing == null) {
return;
}
+ this.urlValid = false;
this.url = $localize`loading..`;
this.sharing = await this.sharingService.updateSharing(
this.currentDir,
@@ -120,32 +132,37 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
this.input.password,
this.calcValidity()
);
- this.url = Utils.concatUrls(Config.Server.publicUrl, '/share/', this.sharing.sharingKey);
+ this.urlValid = true;
+ this.url = this.sharingService.getUrl(this.sharing);
+ await this.updateActiveSharesList();
}
async get(): Promise {
+ this.urlValid = false;
this.url = $localize`loading..`;
this.sharing = await this.sharingService.createSharing(
this.currentDir,
this.input.includeSubfolders,
this.calcValidity()
);
- this.url = Utils.concatUrls(Config.Server.publicUrl, '/share/', this.sharing.sharingKey);
+ this.url = this.sharingService.getUrl(this.sharing);
+ this.urlValid = true;
await this.updateActiveSharesList();
}
async openModal(template: TemplateRef): Promise {
- await this.get();
+ this.url = $localize`Click share to get a link.`;
+ this.urlValid = false;
+ this.sharing = null;
this.input.password = '';
if (this.modalRef) {
this.modalRef.hide();
}
this.modalRef = this.modalService.show(template);
- document.body.style.paddingRight = '0px';
}
onCopy(): void {
- this.notification.success($localize`Url has been copied to clipboard`);
+ this.notification.success($localize`Sharing link has been copied to clipboard`);
}
public hideModal(): void {
@@ -153,6 +170,16 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
this.modalRef = null;
this.sharing = null;
}
+
+ async share() {
+ await this.get();
+ if (this.clipboardService.isSupported) {
+ this.clipboardService.copy(this.url);
+ this.onCopy();
+ }
+
+ }
+
}
diff --git a/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts
index c3f3fed5e..e2b3e4d5e 100644
--- a/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts
+++ b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts
@@ -2,6 +2,8 @@ import {Component, OnInit} from '@angular/core';
import {SharingDTO} from '../../../../../common/entities/SharingDTO';
import {SettingsService} from '../settings.service';
import {ShareService} from '../../gallery/share.service';
+import {AuthenticationService} from '../../../model/network/authentication.service';
+import {UserRoles} from '../../../../../common/entities/UserDTO';
@Component({
selector: 'app-settigns-sharings-list',