diff --git a/CHANGELOG.md b/CHANGELOG.md index 63778f77..ba6ca8be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +5.5.0 / 2026/xx/xx +------------------ + +* デフォルトの User Agent に、summaly の readme へのリンクを含めるようにしました。 +* 現在お使いの summaly のバージョンを export するように + 5.4.0 / 2026/05/11 ------------------ * テキストのデコードに `TextDecoder` を使用するように diff --git a/README.md b/README.md index 129b1e27..389738a8 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ summaly [![][himawari-badge]][himasaku] [![][sakurako-badge]][himasaku] +Get summary of web page. + Installation ---------------------------------------------------------------- ``` @@ -49,7 +51,7 @@ npm run serve | **followRedirects** | *boolean* | Whether follow redirects | `true` | | **plugins** | *plugin[]* (see below) | Custom plugins | `null` | | **agent** | *Got.Agents* | Custom HTTP agent (see below) | `null` | -| **userAgent** | *string* | User-Agent for the request | `SummalyBot/[version]` | +| **userAgent** | *string* | User-Agent for the request | `SummalyBot/[version] (+[Link to README file in GitHub])` | | **responseTimeout** | *number* | Set timeouts for each phase, such as host name resolution and socket communication. | `20000` | | **operationTimeout** | *number* | Set the timeout from the start to the end of the request. | `60000` | | **contentLengthLimit** | *number* | If set to true, an error will occur if the content-length value returned from the other server is larger than this parameter (or if the received body size exceeds this parameter). | `10485760` | diff --git a/src/index.ts b/src/index.ts index e0f94950..14761ff7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -72,6 +72,8 @@ export const summalyDefaultOptions = { plugins: [], } as SummalyOptions; +export const version = _VERSION_; + /** * Summarize an web page */ diff --git a/src/utils/got.ts b/src/utils/got.ts index eaa9e55c..3fd2b407 100644 --- a/src/utils/got.ts +++ b/src/utils/got.ts @@ -29,7 +29,7 @@ export type GotOptions = { export const DEFAULT_RESPONSE_TIMEOUT = 20 * 1000; export const DEFAULT_OPERATION_TIMEOUT = 60 * 1000; export const DEFAULT_MAX_RESPONSE_SIZE = 10 * 1024 * 1024; -export const DEFAULT_BOT_UA = `SummalyBot/${_VERSION_}`; +export const DEFAULT_BOT_UA = `SummalyBot/${_VERSION_} (+https://github.com/misskey-dev/summaly/blob/master/README.md)`; export function getGotOptions(url: string, opts?: GeneralScrapingOptions): Omit { return {