mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-01 10:56:31 +08:00
feature (Share): workable version for sharing
This commit is contained in:
@ -35,3 +35,19 @@ export function absoluteToRelative(from, to){
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
export function currentShare(){
|
||||
return new window.URL(location.href).searchParams.get("share") || ""
|
||||
}
|
||||
|
||||
export function appendShareToUrl(link) {
|
||||
let url = new window.URL(location.href);
|
||||
let share = url.searchParams.get("share");
|
||||
|
||||
if(share){
|
||||
url = new window.URL(location.origin + link)
|
||||
url.searchParams.set("share", share)
|
||||
return url.pathname + url.search
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user