uaExtra設定を追加し、ユーザーエージェントを拡張できるように
This commit is contained in:
parent
9fff449ba6
commit
bdf915528a
2 changed files with 5 additions and 3 deletions
|
@ -3,12 +3,16 @@ import 'reflect-metadata';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { initDb } from './backend/services/db.js';
|
import { initDb } from './backend/services/db.js';
|
||||||
import { ua } from './backend/services/misskey.js';
|
import {config} from './config.js';
|
||||||
|
|
||||||
|
export const ua = `Mozilla/5.0 MisskeyTools +https://github.com/shrimpia/misskey-tools Node/${process.version} ${config.uaExtra ?? ''}`;
|
||||||
|
|
||||||
axios.defaults.headers['User-Agent'] = ua;
|
axios.defaults.headers['User-Agent'] = ua;
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json';
|
axios.defaults.headers['Content-Type'] = 'application/json';
|
||||||
axios.defaults.validateStatus = (stat) => stat < 500;
|
axios.defaults.validateStatus = (stat) => stat < 500;
|
||||||
|
|
||||||
|
console.log(`Initiailizing axios with UA ${ua}...`);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await initDb();
|
await initDb();
|
||||||
(await import('./backend/services/worker.js')).default();
|
(await import('./backend/services/worker.js')).default();
|
||||||
|
|
|
@ -2,8 +2,6 @@ import axios from 'axios';
|
||||||
import {printLog} from '../store.js';
|
import {printLog} from '../store.js';
|
||||||
import {delay} from '../utils/delay.js';
|
import {delay} from '../utils/delay.js';
|
||||||
|
|
||||||
export const ua = `Mozilla/5.0 MisskeyTools +https://github.com/shrimpia/misskey-tools Node/${process.version}`;
|
|
||||||
|
|
||||||
const RETRY_COUNT = 5;
|
const RETRY_COUNT = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue