Skip to content

Commit 08e0dcc

Browse files
committed
Add adsense check code
1 parent d442f3e commit 08e0dcc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Card } from "../src/card.ts";
22
import { CONSTANTS, parseParams } from "../src/utils.ts";
33
import { COLORS, Theme } from "../src/theme.ts";
4-
import { Error400 } from "../src/error_page.ts";
4+
import { Error200 } from "../src/error_page.ts";
55
import "https://deno.land/x/dotenv@v0.5.0/load.ts";
66
import { staticRenderRegeneration } from "../src/StaticRenderRegeneration/index.ts";
77
import { GithubRepositoryService } from "../src/Repository/GithubRepository.ts";
@@ -63,7 +63,7 @@ async function app(req: Request): Promise<Response> {
6363

6464
if (username === null) {
6565
const [base] = req.url.split("?");
66-
const error = new Error400(
66+
const error = new Error200(
6767
`<section>
6868
<div>
6969
<h2>"username" is a required query parameter</h2>

src/error_page.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ abstract class BaseError {
1111
<html lang="en"><head>
1212
<meta charset="UTF-8">
1313
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14+
<meta name="google-adsense-account" content="ca-pub-7387527627218970">
1415
<title>GitHub Profile Trophy</title>
1516
<meta name="description" content="🏆 Add dynamically generated GitHub Stat Trophies on your readme">
1617
<style>
@@ -101,9 +102,10 @@ abstract class BaseError {
101102
}
102103
}
103104
</style>
105+
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7387527627218970" crossorigin="anonymous"></script>
104106
</head>
105107
<body>
106-
<h1 style="text-align: center;">${this.status} - ${this.message}</h1>
108+
<h1 style="text-align: center;">${this.message}</h1>
107109
<p style="text-align: center;">${this.content ?? ""}</p>
108110
${
109111
this.content &&
@@ -114,6 +116,11 @@ abstract class BaseError {
114116
}
115117
}
116118

119+
export class Error200 extends BaseError {
120+
readonly status = 200;
121+
readonly message = "";
122+
}
123+
117124
export class Error400 extends BaseError {
118125
readonly status = 400;
119126
readonly message = "Bad Request";

0 commit comments

Comments
 (0)