Coder Social home page Coder Social logo

pushdeer-node's Introduction

pushdeer-node 是 pushdeer 的Node实现版本,采用 nestjs 开发 。

起因

easychen 的微博中知道了这个项目,了解了一下觉得非常有意思,只要实现了相关api就能够使用pushdeer的自架版客户端。正好这段时间在看 nestjs ,于是就使用 nestjs 进行移植。

目录

说明

该项目参考了 pushdeer 的大量写法,包括但不限于API、 Dockerfile、docker-compose.yml等

特性

立即体验

将下方地址设置为endpoint即可体验!(下方地址仅供体验使用!长久使用建议自行部署!)

https://pushdeer-node.vercel.app

运行方式

环境变量

变量 默认值 说明
DB_TYPE mariadb 数据库类型,可选值mariadb、mysql
DB_HOST 127.0.0.1 数据库地址,支持mariadb 10.5.8+ 、mysql 8+
DB_DATABASE pushdeer 数据库
DB_USERNAME root 数据库用户名
DB_PORT 3306 数据库端口
DB_PASSWORD theVeryp@ssw0rd 数据库密码
REDIS_PORT 6379 redis端口号
REDIS_HOST 127.0.0.1(开发时) redis地址
APP_DEBUG false 是否开启debug模式,开启时终端会打印相关请求
MAX_PUSH_EVERY_USER_PER_MINUTE 120 每个ip下每分钟发送消息的最大次数是
MAX_PUSH_KEY_PER_TIME 100 批量发消息时pushkey的最大数量
MAX_EVERY_API_LIMIT_PER_MINUTE 60 每个ip下每分钟调用接口的最大次数(发送消息接口除外)
GITHUB_CLIENT_ID - GitHub 中申请的应用id(见下文申请)
GITHUB_CLIENT_SECRET - GitHub 中申请的应用密钥(见下文申请)
FCM_API_KEY - Google Cloud Platform API 密钥(见下文申请)
FCM_PUBLIC_KEY - Web 推送证书公钥(见下文申请)
FCM_PRIVATE_KEY - Web 推送证书私钥(见下文申请)

使用目录下docker-compose配置文件

git clone https://github.com/xkrfer/pushdeer-node --depth=1

docker-compose -f <docker-compose配置文件> up --build -d

# 运行成功后 访问 http://ip:8800 可以确认是否搭建成功
  • docker-compose.yml
    • 数据库为docker环境,适合对数据留存不敏感用户使用。
  • docker-compose.mysql.yml
    • 需自行在文件中填入mysql或mariadb的相关信息,适合已有数据库服务的用户使用。

注意:使用源码构建的用户,因为在构建中需从外网拉取相关依赖,故构建机器需支持外网访问。

如果想省去源码构建这一步,可将docker-compose.yml中app部分改成如下即可

- build: '.'
+ image: 'xkrfer/pushdeer-node:latest'

Railway 部署

没有服务器?试试一键Railway 部署!点击查看 使用Railway部署教程

Deploy on Railway

开发方式

启动mariadb、redis

docker-compose -f docker-compose.dev.yml up  -d

启动项目

git clone https://github.com/xkrfer/pushdeer-node

cd pushdeer-node

npm install

npm run start:dev

# 端口号8800

# swagger 地址为 http://localhost:8800/swagger-ui

浏览器插件使用

准备

  • 科学上网的环境
  • GitHub 账号
  • Google 账号
  • 假定我们是部署在某台内网的机器上,此机器的ip地址为 A

申请GitHub App

  1. 登录GitHub
  2. 注册一个应用 New OAuth Application (路径为:右上角个人头像 > Settings > Developer settings > OAuth Apps -> New OAuth App),填入信息如下:
    1. Application name 应用名,可随意填写
    2. Homepage URL,我们假定部署后的地址为 http://{A}:8800
    3. Authorization callback URL,此处填写 http://{A}:8800/login/github
    4. 点击 Register application ,创建成功后会进入应用详情页
    5. 此时我们可以看到 Client ID ,接下来我们点击 Generate a new client secret 生成 Client Secrets
    6. GitHub 生成完毕,此时我们记录创建后的 Client ID 以及 Client Secrets

申请推送API

  1. 打开 firebase

  2. 获取推送相关密钥见下图

    申请FCM

运行

将上述申请的信息依次填入docker-compose.yml中并启动容器。

注意事项

  1. 由于GFW的存在,如果使用Chrome接受推送消息,必须将本程序部署在国外的服务器上或具有科学上网环境的服务器中
  2. Edge可正常部署

致谢

感谢 pushdeer 的相关开发人员,包括但不限于 easychenHext123 等。

本项目是 pushdeer Node练手版,上生产建议使用 pushdeer

License

Copyright 2022 xkrfer.

Licensed under the MIT License.

pushdeer-node's People

Contributors

xkrfer avatar

Watchers

tonyleelyy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.