File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ export default function handler(request, response) {
33
44 const query = request . query ;
55
6- let html = ' Try adding a <code>?url=</code>.' ;
6+ let json = { "error" : " Try adding a URL" } ;
77
88 if ( query . url ) {
99
@@ -13,17 +13,23 @@ export default function handler(request, response) {
1313 url = 'https://dev.codeit.codes' ;
1414 }
1515
16- html = `
17- <oembed>
18- <html><iframe src="` + url + `/api/link?url=` + query . url + `&embed=true" width="700" height="480" style="border-radius: 10px;" allow="accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write" allowfullscreen="true" allowpaymentrequest="true" loading="lazy" sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="yes" frameborder="0"></iframe></html>
19- <width>700</width>
20- <height>480</height>
21- </oembed>
22- ` ;
16+ const embedHTML = `<iframe src="` + url + `/api/link?url=` + query . url + `&embed=true" width="700" height="480" style="border-radius: 10px;" allow="accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write" allowfullscreen="true" allowpaymentrequest="true" loading="lazy" sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="yes" frameborder="0"></iframe></html>` ;
17+
18+ json = {
19+ "type" : "rich" ,
20+ "title" : "Codeit" ,
21+ "width" : 700 ,
22+ "height" : 480 ,
23+ "html" : embedHTML ,
24+ "version" : "1.0" ,
25+ "cache_age" : 3600 ,
26+ "provider_name" : "Codeit" ,
27+ "provider_url" : "https://codeit.codes/"
28+ } ;
2329
2430 }
2531
26- response . status ( 200 ) . send ( html ) ;
32+ response . status ( 200 ) . json ( json ) ;
2733
2834}
2935
You can’t perform that action at this time.
0 commit comments