分别复制 config/client-template.ts
和 config/server-template.ts
为 config/client.ts
和 config/server.ts
,配置您的客户端和服务端。
本项目基于 Bun 开发,您需要全局安装 Bun:
npm install -g bun
本项目依赖于 PostgreSQL 数据库。
编辑 config/server.ts
,填写连接到 PostgreSQL 数据库的配置信息:
export const serverConfig: ServerConfig = {
database: {
user: 'your_postgresql_user',
password: 'your_postgresql_password',
host: '127.0.0.1',
port: 5432,
database: 'timeline',
},
}
其中,数据库需要手动创建。例如使用 psql
工具创建名为 timeline
的数据库:
CREATE DATABASE timeline;
开发环境下将使用添加 _dev
后缀名的数据库。因此,如果您需要进行二次开发,还应当创建名为 timeline_dev
的数据库:
CREATE DATABASE timeline_dev;
添加需要同步的 Bilibili 收藏夹:
export const serverConfig: ServerConfig = {
services: [
{
type: SyncServiceType.BILIBILI_COLLECTION,
id: 'MyBilibiliCollections',
label: 'My Bilibili Collections',
mediaId: '75618059',
},
],
}
添加需要同步的站点 Feed:
export const serverConfig: ServerConfig = {
services: [
{
type: SyncServiceType.FEED,
id: 'MyBlog',
label: 'My Blog Articles',
syntax: 'atom',
url: 'https://blog.example.com/atom.xml',
},
],
}
需要提供 Github Personal Access Token(在此创建):
export const serverConfig: ServerConfig = {
githubPersonalAccessToken: 'ghp_yourGithubPersonalAccessToken',
}
添加需要同步评论的 Issue:
export const serverConfig: ServerConfig = {
services: [
{
type: SyncServiceType.GITHUB_ISSUE_COMMENT,
id: 'GithubIssueComments',
label: 'My Github Issue Comments',
owner: 'github_repo_owner',
repo: 'github_repo_name',
issueNumber: 1,
},
],
}
export const serverConfig: ServerConfig = {
/** 服务端监听端口 */
listeningPort: 4000,
/** 同步 Timeline 信息的 Cron 规则;这里表示每小时的 0 和 30 分钟执行一次同步操作 */
syncInterval: '*/30 * * * *',
}
bun run dev:client
bun run dev:server
bun run build:client
bun run start:server