@@ -5,24 +5,20 @@ const logger = Logger.plugin("PluginTemplate");
55const { toast } = common ;
66
77async function fetchQuickVidsLink ( content : string ) : Promise < string > {
8- const response = await fetch (
9- "https://api.quickvids.win/v1/shorturl/create" ,
10- {
11- method : "POST" ,
12- headers : { "Content-Type" : "application/json" } ,
13- // eslint-disable-next-line @typescript-eslint/naming-convention
14- body : JSON . stringify ( { input_text : content } ) ,
15- } ,
16- ) ;
8+ const response = await fetch ( "https://api.quickvids.win/v1/shorturl/create" , {
9+ method : "POST" ,
10+ headers : { "Content-Type" : "application/json" } ,
11+ // eslint-disable-next-line @typescript-eslint/naming-convention
12+ body : JSON . stringify ( { input_text : content } ) ,
13+ } ) ;
1714 const data = await response . json ( ) ;
1815 if ( data . quickvids_url ) {
1916 return data . quickvids_url ;
2017 }
21- toast . toast (
22- "Failed to convert a TikTok link(s) to QuickVids link(s)." ,
23- toast . Kind . FAILURE ,
24- { duration : 2000 , position : toast . Position . BOTTOM } ,
25- ) ;
18+ toast . toast ( "Failed to convert a TikTok link(s) to QuickVids link(s)." , toast . Kind . FAILURE , {
19+ duration : 2000 ,
20+ position : toast . Position . BOTTOM ,
21+ } ) ;
2622 return content ;
2723}
2824
@@ -65,19 +61,17 @@ async function replaceLinks(content: string): Promise<string> {
6561 content = content . replace ( link , quickvidsLink ) ;
6662 } catch ( error ) {
6763 logger . error ( error ) ;
68- toast . toast (
69- "Failed to convert a TikTok link(s) to QuickVids link(s)." ,
70- toast . Kind . FAILURE ,
71- { duration : 2000 , position : toast . Position . BOTTOM } ,
72- ) ;
64+ toast . toast ( "Failed to convert a TikTok link(s) to QuickVids link(s)." , toast . Kind . FAILURE , {
65+ duration : 2000 ,
66+ position : toast . Position . BOTTOM ,
67+ } ) ;
7368 }
7469 }
7570 if ( content !== originalContent ) {
76- toast . toast (
77- "Successfully converted TikTok link(s) to QuickVids link(s)." ,
78- toast . Kind . SUCCESS ,
79- { duration : 2000 , position : toast . Position . BOTTOM } ,
80- ) ;
71+ toast . toast ( "Successfully converted TikTok link(s) to QuickVids link(s)." , toast . Kind . SUCCESS , {
72+ duration : 2000 ,
73+ position : toast . Position . BOTTOM ,
74+ } ) ;
8175 }
8276 return content ;
8377}
0 commit comments