Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Aug 19, 2023
1 parent b895861 commit 7b1fc57
Show file tree
Hide file tree
Showing 87 changed files with 355 additions and 341 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title><%= productName %></title>
Expand Down
14 changes: 7 additions & 7 deletions quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
// Configuration for your app
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js

const { extend } = require("quasar")
const { configure } = require("quasar/wrappers")
const esbuild = require("esbuild")
const { obfuscate } = require("javascript-obfuscator")
const { extend } = require("quasar")
const { configure } = require("quasar/wrappers")

function removeDataTestAttrs(node) {
if (node.type === 1 /* NodeTypes.ELEMENT */) {
node.props = node.props.filter((prop) =>
prop.type === 6 /* NodeTypes.ATTRIBUTE */
? prop.name !== "data-test"
: true
: true,
)
}
}
Expand Down Expand Up @@ -46,7 +46,7 @@ function vitePluginBuildRaw() {
].map(([name, value]) => [
`process.env.${name.replace(/[^\w\d_$]/g, "_")}`,
JSON.stringify(value),
])
]),
),
})
const { text } = code.outputFiles[0]
Expand All @@ -71,9 +71,9 @@ function vitePluginBuildRaw() {
id.includes("&minify") ||
process.env.NODE_ENV !== "production",
treeShaking: true,
}
},
).code
: text
: text,
)}`,

map: null,
Expand Down Expand Up @@ -157,7 +157,7 @@ module.exports = configure((/* ctx */) => {
// removes the protocol and replaces it with the port we're connecting to
host: process.env.GITPOD_WORKSPACE_URL.replace(
"https://",
"9000-"
"9000-",
),
protocol: "wss",
clientPort: 443,
Expand Down
4 changes: 2 additions & 2 deletions src/apis/__helpers__/parseItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function parseItem($: CheerioAPI, $li: Cheerio<Element>, now: number) {
.trim()
.replace("Lượt xem:", "")
.trim()
.replace(/,/g, "")
.replace(/,/g, ""),
)
const follows =
$info.length === 0
Expand All @@ -46,7 +46,7 @@ export function parseItem($: CheerioAPI, $li: Cheerio<Element>, now: number) {
.text()
.trim()
.replace("Lượt theo dõi:", "")
.replace(/,/g, "")
.replace(/,/g, ""),
)
const tags = $li
.find(".list-tags")
Expand Down
6 changes: 3 additions & 3 deletions src/apis/__helpers__/parseTimeAgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export function parseTimeAgo(ago: string, now: number): number {
"/" +
($5?.slice(1) ?? new Date(now).getFullYear())
)
}
)
},
),
).getTime() ||
new Date(
ago.replace(/^(\d{1,2})\/(\d{1,2})\/(\d{1,2})$/, "$2/$1/$3")
ago.replace(/^(\d{1,2})\/(\d{1,2})\/(\d{1,2})$/, "$2/$1/$3"),
).getTime()
)
}
14 changes: 7 additions & 7 deletions src/apis/nettruyen/parsers/[general].ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function general(html: string, now: number) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const path = parsePath($item.attr("href")!).replace(
/\/tim-truyen(\/[^?]|$)/,
"/the-loai$1"
"/the-loai$1",
)
const name = $item.text()

Expand All @@ -55,7 +55,7 @@ export default function general(html: string, now: number) {

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const value = new URL(path, "http://localhost").searchParams.get(
"status"
"status",
)!

return { name, value }
Expand All @@ -71,7 +71,7 @@ export default function general(html: string, now: number) {

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const value = new URL(path, "http://localhost").searchParams.get(
"sort"
"sort",
)!

return { name, value }
Expand All @@ -80,22 +80,22 @@ export default function general(html: string, now: number) {

const filters = [genres, status, sort]
const items = $(
"#ctl00_divCenter > div.Module.Module-170 .item, .items .item"
"#ctl00_divCenter > div.Module.Module-170 .item, .items .item",
)
.toArray()
.map((item) => parseItem($, $(item), now))

const $curPage = parseInt(
$("#ctl00_mainContent_ctl01_divPager .active").text().trim()
$("#ctl00_mainContent_ctl01_divPager .active").text().trim(),
)
const curPage = Number.isNaN($curPage) ? 1 : $curPage
const maxPage = $curPage
? parseInt(
new URL(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$("#ctl00_mainContent_ctl01_divPager a").last().attr("href")!,
"http://localhost"
).searchParams.get("page") ?? "1"
"http://localhost",
).searchParams.get("page") ?? "1",
)
: 1

Expand Down
6 changes: 3 additions & 3 deletions src/apis/nettruyen/parsers/__helpers__/parseComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export interface RComment {
export function parseComment(
$: CheerioAPI,
$item: Cheerio<Element>,
now: number
now: number,
): RComment {
const id = parseInt(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$item.attr("id")!.match(/\d+/)![0]
$item.attr("id")!.match(/\d+/)![0],
)

const author = {
Expand All @@ -45,7 +45,7 @@ export function parseComment(
$item
.find(".member > .progress-bar")
.attr("style")!
.match(/width:\s*(\d+)/)![1]
.match(/width:\s*(\d+)/)![1],
),
},
chapter: normalizeChName($item.find(".cmchapter").text().trim()),
Expand Down
4 changes: 2 additions & 2 deletions src/apis/nettruyen/parsers/__helpers__/parseItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getImage } from "./getImage"
function findWithFirstText(
$: CheerioAPI,
$list: Cheerio<Element>,
text: string
text: string,
) {
return $(
$list.toArray().find((el) => {
Expand All @@ -19,7 +19,7 @@ function findWithFirstText(
if (c.startsWith(text)) return true

return false
})
}),
)
.text()
.trim()
Expand Down
8 changes: 4 additions & 4 deletions src/apis/nettruyen/parsers/truyen-tranh/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export default function slug(html: string, now: number) {
// eslint-disable-next-line camelcase
const updated_at = parseTimeAgo(
$detail.find("time").text().trim().slice(16, -1),
now
now,
)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const image = getImage(
$("#item-detail > div.detail-info > div > div.col-xs-4.col-image > img")
$("#item-detail > div.detail-info > div > div.col-xs-4.col-image > img"),
)!

const othername = $detail.find(".othername p:not(.name)").text().trim()
Expand All @@ -38,7 +38,7 @@ export default function slug(html: string, now: number) {
.toArray()
.map((item) => parseAnchor($(item)))
const views = parseInt(
$detail.find(".kind").next().find("p:not(.name)").text().replace(/\./, "")
$detail.find(".kind").next().find("p:not(.name)").text().replace(/\./, ""),
)
const $rate = $detail.find("span[itemprop=aggregateRating]")
const rate =
Expand Down Expand Up @@ -75,7 +75,7 @@ export default function slug(html: string, now: number) {
$("#ctl00_mainContent_divPager > ul > li:nth-child(14) > a")
.last()
.attr("href")
?.slice(1) ?? "1"
?.slice(1) ?? "1",
) || 1

return {
Expand Down
12 changes: 6 additions & 6 deletions src/apis/nettruyen/parsers/truyen-tranh/[slug]/[ep-id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function epId(html: string, now: number) {

const name = $("h1").text().split("-").slice(0, -1).join("-").trim()
const { path: manga } = parseAnchor(
$("#ctl00_divCenter > div > div:nth-child(1) > div.top > h1 > a")
$("#ctl00_divCenter > div > div:nth-child(1) > div.top > h1 > a"),
)
const uid = parseInt(html.match(/gOpts\.comicId=(\d+)/)?.[1] ?? "")
const ep_id = parseInt(html.match(/gOpts\.chapterId=(\d+)/)?.[1] ?? "")
Expand All @@ -26,7 +26,7 @@ export default function epId(html: string, now: number) {
.text()
.trim()
.slice(16, -1),
now
now,
)
const pages = $(".reading-detail img")
.toArray()
Expand All @@ -49,7 +49,7 @@ export default function epId(html: string, now: number) {
$("#ctl00_mainContent_divPager > ul > li:nth-child(14) > a")
.last()
.attr("href")
?.slice(1) ?? "1"
?.slice(1) ?? "1",
) || 1

return {
Expand Down Expand Up @@ -95,15 +95,15 @@ export const SERVERS: {
return withProxyDeno(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
decodeURIComponent(item.original!.split("&url", 2)[1]),
headersNettruyen
headersNettruyen,
)
}

return withProxyDeno(
`https://images2-focus-opensocial.googleusercontent.com/gadgets/proxy?container=focus&gadget=a&no_expand=1&resize_h=0&rewriteMime=image%2F*&url=${encodeURIComponent(
item.original
item.original,
)}`,
headersNettruyen
headersNettruyen,
)
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/apis/nettruyen/runs/[general].ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Worker from "../workers/[general]?worker"
export default async function (
path: string,
page: number,
query: LocationQuery | Record<string, string | number>
query: LocationQuery | Record<string, string | number>,
) {
if (path.endsWith("/")) path = path.slice(0, -1)

Expand Down
2 changes: 1 addition & 1 deletion src/apis/nettruyen/runs/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function login(username: string, password: string) {
ctl00$mainContent$login1$LoginCtrl$Password: password,
ctl00$mainContent$login1$LoginCtrl$RememberMe: "on",
ctl00$mainContent$login1$LoginCtrl$Login: "Đăng nhập",
}
},
)

// eslint-disable-next-line functional/no-throw-statement
Expand Down
2 changes: 1 addition & 1 deletion src/apis/nettruyen/runs/auth/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default async function (token: string) {
{},
{
cookie: `.ASPXAUTH=${token}`,
}
},
)

const $data = JSON.parse(data)
Expand Down
4 changes: 2 additions & 2 deletions src/apis/nettruyen/runs/get-list-chapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CURL } from "../const"
export default async function (manga_id: number) {
const { data } = await get(
// eslint-disable-next-line camelcase
`${CURL}/Comic/Services/ComicService.asmx/ProcessChapterList?comicId=${manga_id}`
`${CURL}/Comic/Services/ComicService.asmx/ProcessChapterList?comicId=${manga_id}`,
)

return JSON.parse(data).chapters.map(
Expand All @@ -17,6 +17,6 @@ export default async function (manga_id: number) {
path: parsePath(item.url),
updated_at: null,
}
}
},
)
}
4 changes: 2 additions & 2 deletions src/apis/nettruyen/runs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import Worker from "../workers/index?worker"
export default async function index() {
const [index, topDay] = await Promise.all([
get(CURL).then((res) =>
PostWorker<typeof Parse>(Worker, res.data, Date.now())
PostWorker<typeof Parse>(Worker, res.data, Date.now()),
),
get(`${CURL}/tim-truyen?status=-1&sort=13`).then((res) =>
PostWorker<typeof general>(WorkerGeneral, res.data, Date.now())
PostWorker<typeof general>(WorkerGeneral, res.data, Date.now()),
),
])

Expand Down
4 changes: 2 additions & 2 deletions src/apis/nettruyen/runs/lich-su.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import Worker from "../workers/[general]?worker"

export default async function (page: number, token: string) {
const { data } = await get(
`${API_CURL}/Comic/Services/ComicService.asmx/GetReadComics?token=${token}&page=${page}`
`${API_CURL}/Comic/Services/ComicService.asmx/GetReadComics?token=${token}&page=${page}`,
)

return PostWorker<typeof Parse>(
Worker,
decodeURIComponent(JSON.parse(data).listHtml),
Date.now()
Date.now(),
)
}
4 changes: 2 additions & 2 deletions src/apis/nettruyen/runs/pre-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Worker from "../workers/pre-search?worker"
export default async function presearch(keyword: string, page: number) {
const { data } = await get(
`${CURL}/Comic/Services/SuggestSearch.ashx?q=${encodeURIComponent(
keyword
)}&page=${page}`
keyword,
)}&page=${page}`,
)

return PostWorker<typeof Parse>(Worker, data)
Expand Down
6 changes: 3 additions & 3 deletions src/apis/nettruyen/runs/theo-doi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export default async function (
page: number,
user_uid: string,
token: string,
type: string
type: string,
) {
const { data } = await get(
`${API_CURL}/Comic/Services/ComicService.asmx/GetFollowedPageComics?page=${page}&userGuid=${user_uid}&loadType=${type}&token=${token}`
`${API_CURL}/Comic/Services/ComicService.asmx/GetFollowedPageComics?page=${page}&userGuid=${user_uid}&loadType=${type}&token=${token}`,
)

return PostWorker<typeof Parse>(
Worker,
decodeURIComponent(JSON.parse(data).followedListHtml),
Date.now()
Date.now(),
)
}
2 changes: 1 addition & 1 deletion src/apis/nettruyen/runs/tim-kiem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Worker from "../workers/[general]?worker"

export default async function (query: string, page: number) {
const { data } = await get(
`${CURL}/tim-truyen?keyword=${encodeURIComponent(query)}&page=${page}`
`${CURL}/tim-truyen?keyword=${encodeURIComponent(query)}&page=${page}`,
)

return PostWorker<typeof Parse>(Worker, data, Date.now())
Expand Down
Loading

0 comments on commit 7b1fc57

Please sign in to comment.