From 2896a2736c835ad815dbe015290cda56b398d2ab Mon Sep 17 00:00:00 2001 From: Vitalii Shpital Date: Mon, 24 May 2021 17:28:29 +0300 Subject: [PATCH] web/satellite: remove time caveats for object browser AGs WHAT: removed notBefore and notAfter caveats from object browser AGs WHY: caused a bug when user's clock is not synced correctly Change-Id: I1af10418f1668003a09cba313eaed3b0764eabdc --- web/satellite/src/components/objects/BucketsView.vue | 5 ----- web/satellite/src/components/objects/UploadFile.vue | 11 +++-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/web/satellite/src/components/objects/BucketsView.vue b/web/satellite/src/components/objects/BucketsView.vue index 64722e509..4689e2669 100644 --- a/web/satellite/src/components/objects/BucketsView.vue +++ b/web/satellite/src/components/objects/BucketsView.vue @@ -130,9 +130,6 @@ export default class BucketsView extends Vue { const cleanAPIKey: AccessGrant = await this.$store.dispatch(ACCESS_GRANTS_ACTIONS.CREATE, this.FILE_BROWSER_AG_NAME); await this.$store.dispatch(OBJECTS_ACTIONS.SET_API_KEY, cleanAPIKey.secret); - const now = new Date(); - const inADay = new Date(now.setDate(now.getDate() + 1)); - await this.worker.postMessage({ 'type': 'SetPermission', 'isDownload': true, @@ -141,8 +138,6 @@ export default class BucketsView extends Vue { 'isDelete': true, 'buckets': [], 'apiKey': cleanAPIKey.secret, - 'notBefore': new Date().toISOString(), - 'notAfter': inADay.toISOString(), }); const grantEvent: MessageEvent = await new Promise(resolve => this.worker.onmessage = resolve); diff --git a/web/satellite/src/components/objects/UploadFile.vue b/web/satellite/src/components/objects/UploadFile.vue index 509af35e8..c24e529d3 100644 --- a/web/satellite/src/components/objects/UploadFile.vue +++ b/web/satellite/src/components/objects/UploadFile.vue @@ -73,11 +73,9 @@ export default class UploadFile extends Vue { */ public async generateObjectMapUrl(path: string): Promise { path = `${this.bucket}/${path}`; - const now = new Date(); - const inADay = new Date(now.setDate(now.getDate() + 1)); try { - const key: string = await this.accessKey(this.apiKey, inADay, path); + const key: string = await this.accessKey(this.apiKey, path); path = encodeURIComponent(path.trim()); @@ -95,12 +93,11 @@ export default class UploadFile extends Vue { public async generateShareLinkUrl(path: string): Promise { path = `${this.bucket}/${path}`; const now = new Date(); - const notAfter = new Date(now.setFullYear(now.getFullYear() + 100)); const LINK_SHARING_AG_NAME = `${path}_shared-object_${now.toISOString()}`; const cleanAPIKey: AccessGrant = await this.$store.dispatch(ACCESS_GRANTS_ACTIONS.CREATE, LINK_SHARING_AG_NAME); try { - const key: string = await this.accessKey(cleanAPIKey.secret, notAfter, path); + const key: string = await this.accessKey(cleanAPIKey.secret, path); path = encodeURIComponent(path.trim()); @@ -125,7 +122,7 @@ export default class UploadFile extends Vue { /** * Generates public access key. */ - private async accessKey(cleanApiKey: string, notAfter: Date, path: string): Promise { + private async accessKey(cleanApiKey: string, path: string): Promise { const satelliteNodeURL = MetaUtils.getMetaContent('satellite-nodeurl'); this.worker.postMessage({ @@ -152,8 +149,6 @@ export default class UploadFile extends Vue { 'isDelete': true, 'paths': [path], 'grant': grantData.value, - 'notBefore': new Date().toISOString(), - 'notAfter': notAfter.toISOString(), }); const event: MessageEvent = await new Promise(resolve => this.worker.onmessage = resolve);