Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d8ca915827
|
|
@ -1,12 +1,18 @@
|
|||
import { serve } from '@hono/node-server';
|
||||
import logger from '@/utils/logger';
|
||||
import { getLocalhostAddress } from '@/utils/common-utils';
|
||||
import { config } from '@/config';
|
||||
import app from '@/app';
|
||||
|
||||
const port = config.connect.port;
|
||||
const hostIPList = getLocalhostAddress();
|
||||
|
||||
logger.info(`🎉 RSSHub is running on port ${port}! Cheers!`);
|
||||
logger.info('💖 Can you help keep this open source project alive? Please sponsor 👉 https://docs.rsshub.app/support');
|
||||
logger.info(`🔗 Local: 👉 http://localhost:${port}`);
|
||||
for (const ip of hostIPList) {
|
||||
logger.info(`🔗 Network: 👉 http://${ip}:${port}`);
|
||||
}
|
||||
|
||||
const server = serve({
|
||||
fetch: app.fetch,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { toTitleCase, collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils';
|
||||
import { toTitleCase, collapseWhitespace, convertDateToISO8601, getLocalhostAddress } from '@/utils/common-utils';
|
||||
|
||||
describe('common-utils', () => {
|
||||
it('toTitleCase', () => {
|
||||
|
|
@ -34,4 +34,8 @@ describe('common-utils', () => {
|
|||
expect(collapseWhitespace('a string already collapsed')).toBe('a string already collapsed');
|
||||
expect(collapseWhitespace(' \n a lot of whitespaces and \n\n\n\n linebreaks \n\n ')).toBe('a lot of whitespaces and linebreaks');
|
||||
});
|
||||
|
||||
it('getLocalhostAddress', () => {
|
||||
expect(getLocalhostAddress()).toBeInstanceOf(Array);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
import title from 'title';
|
||||
import os from 'os';
|
||||
|
||||
// convert a string into title case
|
||||
const toTitleCase = (str: string) => title(str);
|
||||
|
|
@ -31,4 +32,14 @@ const getSubPath = (ctx) => {
|
|||
return subPath;
|
||||
};
|
||||
|
||||
export { toTitleCase, collapseWhitespace, convertDateToISO8601, getSubPath };
|
||||
const getLocalhostAddress = () => {
|
||||
const interfaces = os.networkInterfaces();
|
||||
const address = Object.keys(interfaces)
|
||||
.flatMap((name) => interfaces[name] ?? [])
|
||||
.filter((iface) => iface?.family === 'IPv4' && !iface.internal)
|
||||
.map((iface) => iface?.address)
|
||||
.filter(Boolean);
|
||||
return address;
|
||||
};
|
||||
|
||||
export { toTitleCase, collapseWhitespace, convertDateToISO8601, getSubPath, getLocalhostAddress };
|
||||
|
|
|
|||
|
|
@ -38,9 +38,14 @@ export default function InstanceList(): JSX.Element {
|
|||
maintainerUrl: 'https://www.pseudoyu.com',
|
||||
}, {
|
||||
url: 'https://rsshub.friesport.ac.cn',
|
||||
location: '🇨🇳',
|
||||
maintainer: '薯条港研究院',
|
||||
maintainerUrl: 'https://space.bilibili.com/1690617042',
|
||||
}, {
|
||||
url: 'https://rsshub.friesport.ac.cn/us',
|
||||
location: '🇺🇸',
|
||||
maintainer: '思维悦动',
|
||||
maintainerUrl: 'https://friesport.ac.cn',
|
||||
maintainer: '薯条港研究院',
|
||||
maintainerUrl: 'https://space.bilibili.com/1690617042',
|
||||
}, {
|
||||
url: 'https://rsshub.atgw.io',
|
||||
location: '🇺🇸',
|
||||
|
|
|
|||
Loading…
Reference in New Issue