mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-25 22:09:36 +02:00
Added support for Steam URLs. Changed default prefix setting options to be dynamically rendered
This commit is contained in:
parent
f1c48e8a15
commit
4143ae8198
3 changed files with 14 additions and 16 deletions
|
@ -2,8 +2,8 @@ export const urlParser = (url: string): string[] => {
|
|||
let parsedUrl: string;
|
||||
let displayUrl: string;
|
||||
|
||||
if (/https?:\/\//.test(url)) {
|
||||
// Url starts with http[s]:// -> leave it as it is
|
||||
if (/(https?|steam):\/\//.test(url)) {
|
||||
// Url starts with http[s]:// or steam:// -> leave it as it is
|
||||
parsedUrl = url;
|
||||
} else {
|
||||
// No protocol -> apply http:// prefix
|
||||
|
@ -11,10 +11,14 @@ export const urlParser = (url: string): string[] => {
|
|||
}
|
||||
|
||||
// Create simplified url to display as text
|
||||
displayUrl = url
|
||||
if (/steam:\/\//.test(url)) {
|
||||
displayUrl = 'Run Steam App';
|
||||
} else {
|
||||
displayUrl = url
|
||||
.replace(/https?:\/\//, '')
|
||||
.replace('www.', '')
|
||||
.replace(/\/$/, '');
|
||||
|
||||
}
|
||||
|
||||
return [displayUrl, parsedUrl]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue