Code Monkey home page Code Monkey logo

lila-push's Introduction

lila-push

Web push microservice for lichess.org.

Setup

  1. Generate a private key.

    openssl ecparam -name prime256v1 -genkey -noout -out private.pem
    
  2. Print public key and set push.web.vapid_public_key in lila configuration:

    openssl ec -in private.pem -pubout -outform DER | tail -c 65 | base64 | tr -d '\n' && echo
    
  3. Run microservice:

    cargo run --release -- --vapid private.pem --subject mailto:[email protected]
    

Usage

lila-push 0.1.0
Niklas Fiekas <[email protected]>
Web push microservice for lichess.org

USAGE:
    lila-push [OPTIONS] --subject <subject> --vapid <vapid>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --bind <address:port>  Listen on this address and port [default: 127.0.0.1:9054]
        --subject <subject>    VAPID subject (example: mailto:[email protected])
        --vapid <vapid>        PEM file with private VAPID key

HTTP API

POST / send a push message

{
  "subs": [{
    "endpoint": "https://fcm.googleapis.com/fcm/send/dpH5lCsTSSM:APA91bHqjZxM0VImWWqDRN7U0a3AycjUf4O-byuxb_wJsKRaKvV_iKw56s16ekq6FUqoCF7k2nICUpd8fHPxVTgqLunFeVeB9lLCQZyohyAztTH8ZQL9WCxKpA6dvTG_TUIhQUFq_n",
    "keys": {
      "p256dh": "BLQELIDm-6b9Bl07YrEuXJ4BL_YBVQ0dvt9NQGGJxIQidJWHPNa9YrouvcQ9d7_MqzvGS9Alz60SZNCG3qfpk=",
      "auth": "4vQK-SvRAN5eo-8ASlrwA=="
    }
  }],
  "payload": "lorem ipsum", // could be json encoded as a string
  "ttl": 43200 // 12 hour limit to deliver
}
{
  "https://fcm.googleapis.com/fcm/send/dpH5lCsTSSM:AP...": "ok"
}
response description
ok success
invalid_uri
invalid_ttl
missing_crypto_keys
invalid_crypto_keys
unauthorized
endpoint_not_found
endpoint_not_valid Subscription is invalid and will never be valid
payload_too_large
not_implemented Endpoint does not support encryption algorithm
tls_error Endpoint misbehaving
ssl_error ...
io_error ...
invalid_response ...
other ...
unspecified ...

License

lila-push is licensed under the GNU Affero General Public License 3.0 (or any later version at your option). See COPYING for the full license text.

lila-push's People

Contributors

andyblarblar avatar dependabot-preview[bot] avatar fitztrev avatar niklasf avatar schlawg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.