diff --git a/deploy/saneUrl/index.js b/deploy/saneUrl/index.js index 3bc0bca9fe6e6eafad1075a0a4b16b2eddddd91e..582113e0c19cc9461c81eb288824e265e0d3bef1 100644 --- a/deploy/saneUrl/index.js +++ b/deploy/saneUrl/index.js @@ -104,7 +104,8 @@ router.post('/:name', limiterMiddleware(), express.json(), async (req, res) => { - if (req.headers['x-noop']) return res.status(200).end() + if (/bot/i.test(req.headers['user-agent'])) return res.status(201).end() + if (req.headers['x-noop']) return res.status(201).end() const { name } = req.params try { await proxyStore.set(req, name, req.body) diff --git a/e2e/checklist.md b/e2e/checklist.md index d03d59b1f8424872c3c88efefa15b01a3b600ecd..fe9d0cb0fa85b4f5eab53e808f4cec5ba91f7bae 100644 --- a/e2e/checklist.md +++ b/e2e/checklist.md @@ -68,6 +68,7 @@ - [ ] saneurl generation functions properly - [ ] try existing key (human), and get unavailable error - [ ] try non existing key, and get available + - [ ] create use key `x-tmp-foo` and new url works - [ ] [saneUrl](https://atlases.ebrains.eu/viewer-staging/saneUrl/bigbrainGreyWhite) redirects to big brain - [ ] [saneUrl](https://atlases.ebrains.eu/viewer-staging/saneUrl/julichbrain) redirects to julich brain (colin 27) - [ ] [saneUrl](https://atlases.ebrains.eu/viewer-staging/saneUrl/whs4) redirects to waxholm v4 diff --git a/src/share/share.module.ts b/src/share/share.module.ts index f3137eaadc83a3aaead101efe1b76cc600301409..ff7011249173857ff344bd58730f7e7881f9e675 100644 --- a/src/share/share.module.ts +++ b/src/share/share.module.ts @@ -8,6 +8,7 @@ import { ReactiveFormsModule, FormsModule } from "@angular/forms"; import { AuthModule } from "src/auth"; import { ShareSheetComponent } from "./shareSheet/shareSheet.component"; import { ShareDirective } from "./share.directive"; +import { StateModule } from "src/state"; @NgModule({ imports: [ @@ -17,6 +18,7 @@ import { ShareDirective } from "./share.directive"; FormsModule, ReactiveFormsModule, AuthModule, + StateModule, ], declarations: [ ClipboardCopy, diff --git a/src/share/shareSheet/shareSheet.component.ts b/src/share/shareSheet/shareSheet.component.ts index 8d4b9f963ebafc0b83850010bf8b18e70f7d6a15..664ffd89c8fe93bf1a7886d80bc83145e7c8b03a 100644 --- a/src/share/shareSheet/shareSheet.component.ts +++ b/src/share/shareSheet/shareSheet.component.ts @@ -1,7 +1,6 @@ -import { Component } from "@angular/core"; +import { Component, TemplateRef } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; import { ARIA_LABELS } from 'common/constants' -import { SaneUrl } from "../saneUrl/saneUrl.component" @Component({ selector: 'sxplr-share-sheet', @@ -18,7 +17,7 @@ export class ShareSheetComponent{ } - openShareSaneUrl(){ - this.dialog.open(SaneUrl, { ariaLabel: ARIA_LABELS.SHARE_CUSTOM_URL }) + openDialog(templateRef: TemplateRef<unknown>){ + this.dialog.open(templateRef, { ariaLabel: ARIA_LABELS.SHARE_CUSTOM_URL }) } } diff --git a/src/share/shareSheet/shareSheet.template.html b/src/share/shareSheet/shareSheet.template.html index cea5242302cf57ff1cc718ac1b2d98b7a9d79f0c..bc953043ba622d6af44df97a27215346bd03521b 100644 --- a/src/share/shareSheet/shareSheet.template.html +++ b/src/share/shareSheet/shareSheet.template.html @@ -17,8 +17,10 @@ <mat-list-item [attr.aria-label]="ARIA_LABELS.SHARE_CUSTOM_URL" [attr.tab-index]="10" - (click)="openShareSaneUrl()" + (click)="openDialog(saneUrlTmpl)" [matTooltip]="ARIA_LABELS.SHARE_CUSTOM_URL" + iav-state-aggregator + #stateAggregator="iavStateAggregator" > <mat-icon class="mr-4" @@ -32,3 +34,9 @@ </mat-list-item> </mat-nav-list> + + +<ng-template #saneUrlTmpl> + <iav-sane-url [stateTobeSaved]="stateAggregator.jsonifiedState$ | async"> + </iav-sane-url> +</ng-template> \ No newline at end of file