Skip to content

Commit

Permalink
IP Family, Syslogd example, Change UA
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Mar 12, 2024
1 parent 0cf6e49 commit 05ee844
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion built/client.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const browserUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36";
export declare const browserUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36";
2 changes: 1 addition & 1 deletion built/client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserUA = void 0;
exports.browserUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36';
exports.browserUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36';
4 changes: 4 additions & 0 deletions built/utils/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.agent = exports.httpsAgent = exports.httpAgent = void 0;
const http = require("http");
const https = require("https");
const process_1 = require("process");
const family = process_1.env.SUMMALY_FAMILY == '4' ? 4 : process_1.env.SUMMALY_FAMILY == '6' ? 6 : undefined;
exports.httpAgent = new http.Agent({
keepAlive: true,
keepAliveMsecs: 30 * 1000,
family,
});
exports.httpsAgent = new https.Agent({
keepAlive: true,
keepAliveMsecs: 30 * 1000,
family,
});
exports.agent = {
http: exports.httpAgent,
Expand Down
2 changes: 1 addition & 1 deletion built/utils/got.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const pipeline = util.promisify(stream.pipeline);
const RESPONSE_TIMEOUT = 20 * 1000;
const OPERATION_TIMEOUT = 60 * 1000;
const MAX_RESPONSE_SIZE = 10 * 1024 * 1024;
const BOT_UA = `Twitterbot/1.0`;
const BOT_UA = `Summalybot/1.0`;
const NOT_BOT_UA = [
'www.sankei.com',
];
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const browserUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36';
export const browserUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36';
5 changes: 5 additions & 0 deletions src/utils/agent.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import * as http from 'http';
import * as https from 'https';
import { env } from 'process';

const family = env.SUMMALY_FAMILY == '4' ? 4 : env.SUMMALY_FAMILY == '6' ? 6 : undefined;

export const httpAgent = new http.Agent({
keepAlive: true,
keepAliveMsecs: 30 * 1000,
family,
} as http.AgentOptions);

export const httpsAgent = new https.Agent({
keepAlive: true,
keepAliveMsecs: 30 * 1000,
family,
} as https.AgentOptions);

export const agent = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/got.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const pipeline = util.promisify(stream.pipeline);
const RESPONSE_TIMEOUT = 20 * 1000;
const OPERATION_TIMEOUT = 60 * 1000;
const MAX_RESPONSE_SIZE = 10 * 1024 * 1024;
const BOT_UA = `Twitterbot/1.0`;
const BOT_UA = `Summalybot/1.0`;

const NOT_BOT_UA = [
'www.sankei.com',
Expand Down
19 changes: 19 additions & 0 deletions summaly.example.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=summaly
After=network.target

[Service]
Type=simple
User=summaly
ExecStart=/usr/bin/node --tls-min-v1.0 ./built/server
WorkingDirectory=/home/summaly/summaly
Environment="NODE_ENV=production"
#Environment="SUMMALY_FAMILY=4"
TimeoutSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=summaly
Restart=always

[Install]
WantedBy=multi-user.target

0 comments on commit 05ee844

Please sign in to comment.