diff --git a/internal/handlers/public.go b/internal/handlers/public.go index fafaa7f..d76835d 100644 --- a/internal/handlers/public.go +++ b/internal/handlers/public.go @@ -117,6 +117,7 @@ func (h *Handler) handleCreate(c *gin.Context) { } originURL := h.getURLOrigin(c) c.JSON(http.StatusOK, requestHelper{ + ID: id, URL: fmt.Sprintf("%s/%s", originURL, id), DeletionURL: fmt.Sprintf("%s/d/%s/%s", originURL, id, url.QueryEscape(base64.RawURLEncoding.EncodeToString(delID))), }) diff --git a/web/src/Home/Home.js b/web/src/Home/Home.js index 2548655..3043a9e 100644 --- a/web/src/Home/Home.js +++ b/web/src/Home/Home.js @@ -33,7 +33,6 @@ export default class HomeComponent extends Component { this.setState({ usedSettings: value }) } - componentDidMount() { this.urlInput.focus() util.getDisplayURL() @@ -43,12 +42,12 @@ export default class HomeComponent extends Component { if (!this.state.showCustomIDError) { util.createEntry({ URL: this.url, - ID: this.state.customID, + ID: this.state.usedSettings.includes("custom") ? this.state.customID : undefined, Expiration: this.state.usedSettings.includes("expire") && this.state.expiration ? this.state.expiration.toISOString() : undefined, Password: this.state.usedSettings.includes("protected") && this.password ? this.password : undefined }, r => this.setState({ links: [...this.state.links, { - shortenedURL: this.state.displayURL + "/" + this.state.customID, + shortenedURL: this.state.displayURL + "/" + r.ID, originalURL: this.url, expiration: this.state.usedSettings.includes("expire") && this.state.expiration ? this.state.expiration.toISOString() : undefined, deletionURL: r.DeletionURL