Linkvertise try number 2
This commit is contained in:
@@ -38,4 +38,21 @@ export function encodeId(documentId: string): string {
|
||||
export function decodeId(encodedId: string): string {
|
||||
const salt = "salty_aff"
|
||||
return Buffer.from(encodedId, 'base64').toString().replace(salt, '')
|
||||
}
|
||||
|
||||
export function btoa(str: string): string {
|
||||
let buffer: Buffer;
|
||||
|
||||
if (Buffer.isBuffer(str)) {
|
||||
buffer = str;
|
||||
} else {
|
||||
buffer = Buffer.from(str, "binary");
|
||||
}
|
||||
return buffer.toString("base64");
|
||||
}
|
||||
|
||||
export function linkvertise(userid: number, link: string): string {
|
||||
let base_url = `https://link-to.net/${userid}/${Math.floor(Math.random() * 1000)}/dynamic`;
|
||||
let href = `${base_url}?r=${btoa(encodeURI(link))}`;
|
||||
return href;
|
||||
}
|
||||
Reference in New Issue
Block a user