Skip to content

Commit ddd7fee

Browse files
committed
1.1.42
1 parent 69c4a1b commit ddd7fee

File tree

10 files changed

+112
-8
lines changed

10 files changed

+112
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable change will be documented here
44

55
Changes like adding data will not be noted here
66

7+
## [1.1.42] - 2021-11-19
8+
9+
- Updated api/insight
10+
711
## [1.1.40] - 2021-11-18
812

913
- Added API to reduce client workload and for 3rd party use (if someone wish to)

api/get.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default (req: VercelRequest, res: VercelResponse) => {
1414
}
1515
} else {
1616
const questions = getRandomQuestions();
17+
1718
if (questions) {
1819
res.status(200).json(questions);
1920
} else {

api/insight.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
import { VercelRequest, VercelResponse } from "@vercel/node";
22
import { getAll } from "../data/data";
3+
import { BuildTime, Version } from "../src/config";
34

45
export default (req: VercelRequest, res: VercelResponse) => {
56
const data = getAll();
67

78
const response = {
89
categories: {},
10+
meta: {
11+
build_time: BuildTime,
12+
version: Version,
13+
},
914
};
1015

1116
for (const cat in data) {
1217
const catData = data[cat];
1318

19+
let correct_count = 0;
20+
catData.questions.forEach((question) => {
21+
if (question.answer) correct_count++;
22+
});
23+
1424
response.categories[cat] = {
1525
questions_count: catData.questions.length,
26+
correct_count,
27+
correct_ratio:
28+
Math.round((correct_count / catData.questions.length) * 1000) / 1000,
1629
};
1730
}
1831

data/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as loli from "./loli.json";
55
import * as trap from "./trap.json";
66
import * as hani from "./hani.json";
77

8-
export const Data: { [category: string]: CaptchaType } = { loli, trap, hani };
8+
const Data: { [category: string]: CaptchaType } = { loli, trap, hani };
99

1010
export function getQuestions(category: string): CaptchaType {
1111
const data = Data[category];

data/hani.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,30 @@
408408
"ja": "やはり俺の青春ラブコメはまちがっている。"
409409
},
410410
"answer": true
411+
},
412+
{
413+
"image": "https://cdn.myanimelist.net/r/360x360/images/characters/2/285624.jpg?s=dec49352cdc2c9b5bbc2c251400e6354",
414+
"name": {
415+
"en": "Yuigahama's Mother",
416+
"ja": "由比ヶ浜母"
417+
},
418+
"anime": {
419+
"en": "My Youth Romantic Comedy Is Wrong, As I Expected",
420+
"ja": "やはり俺の青春ラブコメはまちがっている。"
421+
},
422+
"answer": true
423+
},
424+
{
425+
"image": "https://i1.wp.com/anitrendz.net/news/wp-content/uploads/2020/12/2020-12-11-20_49_12-Greenshot.png",
426+
"name": {
427+
"en": "Elaina",
428+
"ja": "イレイナ"
429+
},
430+
"anime": {
431+
"en": "Wandering Witch: The Journey of Elaina",
432+
"ja": "魔女の旅々"
433+
},
434+
"answer": true
411435
}
412436
],
413437
"onFail": {

data/loli.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,16 +446,40 @@
446446
"answer": false
447447
},
448448
{
449-
"image": "https://yaharibento.files.wordpress.com/2016/03/yahari-oregariu-zoku-anime-ep3-32-yukinoshita-haruno.jpg?w=740",
449+
"image": "https://cdn.myanimelist.net/r/360x360/images/characters/2/285624.jpg?s=dec49352cdc2c9b5bbc2c251400e6354",
450450
"name": {
451-
"en": "Yukinoshita Haruno",
452-
"ja": "雪ノ下陽乃"
451+
"en": "Yuigahama's Mother",
452+
"ja": "由比ヶ浜母"
453453
},
454454
"anime": {
455455
"en": "My Youth Romantic Comedy Is Wrong, As I Expected",
456456
"ja": "やはり俺の青春ラブコメはまちがっている。"
457457
},
458458
"answer": true
459+
},
460+
{
461+
"image": "https://i1.wp.com/anitrendz.net/news/wp-content/uploads/2020/12/2020-12-11-20_49_12-Greenshot.png",
462+
"name": {
463+
"en": "Elaina",
464+
"ja": "イレイナ"
465+
},
466+
"anime": {
467+
"en": "Wandering Witch: The Journey of Elaina",
468+
"ja": "魔女の旅々"
469+
},
470+
"answer": true
471+
},
472+
{
473+
"image": "https://i.pinimg.com/originals/fb/56/4e/fb564eb5becf892426d5a439e55a44db.jpg",
474+
"name": {
475+
"en": "Uesugi Raiha",
476+
"ja": "上杉らいは"
477+
},
478+
"anime": {
479+
"en": "Quintessential Quintuplets",
480+
"ja": "五等分の花嫁"
481+
},
482+
"answer": false
459483
}
460484
],
461485
"onFail": {

data/trap.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,42 @@
396396
"ja": "やはり俺の青春ラブコメはまちがっている。"
397397
},
398398
"answer": true
399+
},
400+
{
401+
"image": "https://i1.wp.com/anitrendz.net/news/wp-content/uploads/2020/12/2020-12-11-20_49_12-Greenshot.png",
402+
"name": {
403+
"en": "Elaina",
404+
"ja": "イレイナ"
405+
},
406+
"anime": {
407+
"en": "Wandering Witch: The Journey of Elaina",
408+
"ja": "魔女の旅々"
409+
},
410+
"answer": true
411+
},
412+
{
413+
"image": "https://s4.anilist.co/file/anilistcdn/character/large/b126825-J4GTiz4OHDa5.png",
414+
"name": {
415+
"en": "Osana Najimi",
416+
"ja": "長名なじみ"
417+
},
418+
"anime": {
419+
"en": "Komi Can't Communicate",
420+
"ja": "古見さんは、コミュ症です。"
421+
},
422+
"answer": false
423+
},
424+
{
425+
"image": "https://i.pinimg.com/originals/fb/56/4e/fb564eb5becf892426d5a439e55a44db.jpg",
426+
"name": {
427+
"en": "Uesugi Raiha",
428+
"ja": "上杉らいは"
429+
},
430+
"anime": {
431+
"en": "Quintessential Quintuplets",
432+
"ja": "五等分の花嫁"
433+
},
434+
"answer": true
399435
}
400436
],
401437
"onFail": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "anime-captcha",
3-
"version": "1.1.40",
3+
"version": "1.1.42",
44
"type": "module",
55
"scripts": {
66
"dev": "yarn config:pkg && vite --port $PORT",

src/components/Debug.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script lang="ts">
2-
import Label from "./AnswerTable/Label.svelte";
2+
import { onMount } from "svelte";
33
4+
import Label from "./AnswerTable/Label.svelte";
45
import { CaptchaType } from "../models/CaptchaType";
5-
import { onMount } from "svelte";
6+
import { trimHTML } from "../utils/Trim";
67
78
let data: { [category: string]: CaptchaType } = {};
89
@@ -15,6 +16,7 @@
1516
<main>
1617
{#each Object.entries(data) as [category, captcha]}
1718
<h1 class="display-6">Category: {category}</h1>
19+
<h2>{trimHTML(captcha.title)}</h2>
1820
<table class="table table-bordered">
1921
<thead>
2022
<tr class="table-info">

src/models/CaptchaType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface Question {
1313
answer: boolean;
1414
}
1515

16-
// * This is the type of JSON File
16+
// * This is the type of JSON File * //
1717
export interface CaptchaType {
1818
// * Title of Captcha (the one appearing on top)
1919
title: string;

0 commit comments

Comments
 (0)