diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go
index c1c27ce..cf601c2 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -163,7 +163,6 @@ func (h *Handler) setHandlers() error {
h.engine.GET("/api/v1/info", h.handleInfo)
h.engine.GET("/d/:id/:hash", h.handleDelete)
h.engine.GET("/ok", h.handleHealthcheck)
- h.engine.GET("/displayurl", h.handleDisplayURL)
// Handling the shorted URLs, if no one exists, it checks
// in the filesystem and sets headers for caching
diff --git a/web/src/Home/Home.js b/web/src/Home/Home.js
index 51db5e4..2548655 100644
--- a/web/src/Home/Home.js
+++ b/web/src/Home/Home.js
@@ -11,22 +11,22 @@ import './Home.css'
export default class HomeComponent extends Component {
constructor(props) {
- super(props);
- this.urlParams = new URLSearchParams(window.location.search);
- this.state = {
- links: [],
- usedSettings: this.urlParams.get('customUrl') ? ['custom'] : [],
- customID: this.urlParams.get('customUrl') ? this.urlParams.get('customUrl') : '',
- showCustomIDError: false,
- expiration: null,
- displayURL: window.location.origin
- }
+ super(props);
+ this.urlParams = new URLSearchParams(window.location.search);
+ this.state = {
+ links: [],
+ usedSettings: this.urlParams.get('customUrl') ? ['custom'] : [],
+ customID: this.urlParams.get('customUrl') ? this.urlParams.get('customUrl') : '',
+ showCustomIDError: false,
+ expiration: null,
+ displayURL: window.location.origin
+ }
}
handleURLChange = (e, { value }) => this.url = value
handlePasswordChange = (e, { value }) => this.password = value
handleCustomExpirationChange = expire => this.setState({ expiration: expire })
handleCustomIDChange = (e, { value }) => {
- this.setState({customID: value})
+ this.setState({ customID: value })
util.lookupEntry(value, () => this.setState({ showCustomIDError: true }), () => this.setState({ showCustomIDError: false }))
}
onSettingsChange = (e, { value }) => {
@@ -36,9 +36,8 @@ export default class HomeComponent extends Component {
componentDidMount() {
this.urlInput.focus()
- fetch("/displayurl")
- .then(response => response.json())
- .then(data => this.setState({displayURL: data}));
+ util.getDisplayURL()
+ .then(displayURL => this.setState({ displayURL }));
}
handleURLSubmit = () => {
if (!this.state.showCustomIDError) {
@@ -71,7 +70,7 @@ export default class HomeComponent extends Component {
{this.urlParams.get("customUrl") ? (