@@ -12,25 +12,27 @@ export default function handler(request, response) {
1212 . replace ( 'https://dev.cde.run/' , '' )
1313 . replace ( 'https://github.com/' , '' )
1414 . replace ( 'https:/github.com/' , '' ) ;
15+
16+ let [ user , repo ] = url . split ( '/' ) ;
1517
16- url = url . split ( '/' ) ;
17-
18- if ( url [ 0 ] && url [ 1 ] ) {
18+ if ( user && repo ) {
1919
20- if ( url [ 1 ] . endsWith ( '.git' ) ) {
20+ if ( repo . endsWith ( '.git' ) ) {
2121
22- url [ 1 ] = url [ 1 ] . slice ( 0 , - ( '.git' . length ) ) ;
22+ repo = repo . slice ( 0 , - ( '.git' . length ) ) ;
2323
2424 }
2525
26- if ( url [ url . length - 1 ] . endsWith ( '.html' )
27- || url [ url . length - 1 ] . endsWith ( '.svg' ) ) {
28-
29- title = 'Run ' + url [ 0 ] + '/' + url [ 1 ] . split ( ':' ) [ 0 ] + ' with Codeit' ;
26+ const repoName = user + '/' + repo . split ( ':' ) [ 0 ] ;
27+
28+ if ( url . endsWith ( '.html' ) ||
29+ url . endsWith ( '.svg' ) ) {
30+
31+ title = 'Run ' + repoName + ' on Codeit' ;
3032
3133 } else {
3234
33- title = 'Open ' + url [ 0 ] + '/' + url [ 1 ] . split ( ':' ) [ 0 ] + ' with Codeit';
35+ title = repoName + ' on Codeit';
3436
3537 }
3638
@@ -56,10 +58,10 @@ const html = `
5658 <meta name="apple-mobile-web-app-title" content="Codeit">
5759
5860 <meta charset="utf-8">
59- <!-- < meta name="description" content="Run JavaScript projects, code your ideas, and share it all on Codeit."> -- >
61+ <meta name="description" content="" >
6062
6163 <meta property="og:title" content="` + title + `">
62- <!-- < meta property="og:description" content="Run JavaScript projects, code your ideas, and share it all on Codeit."> -- >
64+ <meta property="og:description" content="" >
6365 <meta property="og:url" content="https://codeit.codes">
6466 <meta property="og:image" content="https://codeit.codes/images/banner-og.png">
6567 <meta property="og:type" content="video.other">
@@ -74,7 +76,7 @@ const html = `
7476 <meta property="twitter:site" content="@codeitcodes">
7577 <meta name="twitter:card" content="player">
7678 <meta property="twitter:domain" content="https://codeit.codes/">
77- <!-- < meta name="twitter:description" content="Run JavaScript projects, code your ideas, and share it all on Codeit."> -- >
79+ <meta name="twitter:description" content="" >
7880 <meta name="twitter:image" content="https://codeit.codes/images/banner-og.png">
7981 <meta name="twitter:player" content="https://codeit.codes/api/link?url=` + query . url + `">
8082 <meta name="twitter:player:stream:content_type" content="text/html">
0 commit comments