Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Commit

Permalink
Add web UI redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
coderworld10 committed Aug 10, 2019
1 parent 003de57 commit 32ea9b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 0 additions & 7 deletions bin/build.sh

This file was deleted.

16 changes: 12 additions & 4 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function extractAlias(shortLink: string): string {
}

class ShortExt {
constructor(private apiBaseUrl: string) {}
constructor(private apiBaseUrl: string, private webUi: string) {
}

redirect = (details: Details): BlockingResponse => {
let shortLink = details.url;
Expand All @@ -34,9 +35,13 @@ class ShortExt {
}

let alias = extractAlias(shortLink);

if (alias) {
return {
redirectUrl: `${this.apiBaseUrl}${alias}`
};
}
return {
redirectUrl: `${this.apiBaseUrl}${alias}`
redirectUrl: `${this.webUi}`
};
};

Expand All @@ -63,5 +68,8 @@ class ShortExt {
}
}

const ext = new ShortExt('http://localhost/r/');
const webUi = 'https://s.time4hacks.com';
const apiBaseUrl = `${webUi}/r/`;

const ext = new ShortExt(apiBaseUrl, webUi);
ext.launch();

0 comments on commit 32ea9b7

Please sign in to comment.