diff --git a/.editorconfig b/.editorconfig index d96a5dd..def7baa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,6 +5,11 @@ indent_style = tab indent_size = 2 charset = utf-8 insert_final_newline = true +end_of_line = lf +trim_trailing_whitespace = true -[*.json] +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] indent_style = space diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..cd8c9c0 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,36 @@ +name: Publish Node.js Package + +on: + release: + types: [created] + + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.10.0] + + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: Publish package + run: | + corepack enable + pnpm i --frozen-lockfile + pnpm build + pnpm publish --access public --no-git-checks --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..716bb3d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Publish Node.js Package + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.10.0] + + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: Install + run: | + corepack enable + pnpm i --frozen-lockfile + pnpm build + - name: Test + run: | + pnpm test diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f2459..5411f65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ -4.x.x (Unreleased) / 2023-09-xx +4.1.0 / 2023-12-30 ------------------ * branch.ioを用いたディープリンク(spotify.link)などでパースに失敗する問題を修正 +* 'mixi:content-rating'をsensitive判定で見ることで、dlsiteなどでセンシティブ情報を得れるように 4.0.2 / 2023-04-20 ------------------ diff --git a/built/general.d.ts b/built/general.d.ts deleted file mode 100644 index c54a068..0000000 --- a/built/general.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { URL } from 'node:url'; -import type { default as Summary } from './summary.js'; -declare const _default: (_url: URL | string, lang?: string | null) => Promise; -export default _default; diff --git a/built/general.js b/built/general.js deleted file mode 100644 index c92d25c..0000000 --- a/built/general.js +++ /dev/null @@ -1,218 +0,0 @@ -import { URL } from 'node:url'; -import clip from './utils/clip.js'; -import cleanupTitle from './utils/cleanup-title.js'; -import { decode as decodeHtml } from 'html-entities'; -import { get, head, scpaping } from './utils/got.js'; -import * as cheerio from 'cheerio'; -/** - * Contains only the html snippet for a sanitized iframe as the thumbnail is - * mostly covered in OpenGraph instead. - * - * Width should always be 100%. - */ -async function getOEmbedPlayer($, pageUrl) { - const href = $('link[type="application/json+oembed"]').attr('href'); - if (!href) { - return null; - } - const oEmbedUrl = (() => { - try { - return new URL(href, pageUrl); - } - catch { - return null; - } - })(); - if (!oEmbedUrl) { - return null; - } - const oEmbed = await get(oEmbedUrl.href).catch(() => null); - if (!oEmbed) { - return null; - } - const body = (() => { - try { - return JSON.parse(oEmbed); - } - catch { } - })(); - if (!body || body.version !== '1.0' || !['rich', 'video'].includes(body.type)) { - // Not a well formed rich oEmbed - return null; - } - if (!body.html.startsWith('