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) {
3
3
4
4
const query = request . query ;
5
5
6
- let html = ' Try adding a <code>?url=</code>.' ;
6
+ let json = { "error" : " Try adding a URL" } ;
7
7
8
8
if ( query . url ) {
9
9
@@ -13,17 +13,23 @@ export default function handler(request, response) {
13
13
url = 'https://dev.codeit.codes' ;
14
14
}
15
15
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
+ } ;
23
29
24
30
}
25
31
26
- response . status ( 200 ) . send ( html ) ;
32
+ response . status ( 200 ) . json ( json ) ;
27
33
28
34
}
29
35
You can’t perform that action at this time.
0 commit comments