Code Monkey home page Code Monkey logo

notica's Introduction

Notica

Send browser notifications from your terminal. No installation. No registration.

https://notica.us/

Usage

Notica is a Bash function / alias that sends a notification to a tab in your browser when it's ran:

$ long-running-command; notica Finished!

This will wait until the first command completes before running Notica. That way you can go do other things while your long task runs. Then you will recieve a notification on any devices that have the Notica website open.

Notification Example gif

Setup

Please follow the instructions on the Notica home page since they are generated specific to you:

https://notica.us/

Source Code

Self-hosting

Hosting Notica on your own server is extremely easy. Clone this repository, change all notica.us URLs to your own domain, and then run yarn install && yarn start.

Usage

Usage: yarn start [options]

  Options:

    -V, --version         output the version number
    -p, --port <port>     Host port (3000)
    -H, --host <IP>       Host IP (127.0.0.1)
    -U, --url <URL>       Website URL (https://notica.us)
    -t, --title <string>  Custom title ('Notification from Notica')
    -i, --icon <path>     Custom icon (img/icon.png)
    -h, --help            output usage information

  Example:

    $ yarn start -p 1234 -t 'My cool Title'

Reverse Proxy

For security, it is recommended to run Notica behind a reverse proxy as a separate non-privileged user.

Here's a sample nginx reverse proxy config:

server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.html index.htm;

    server_name notica.us;

    location / {
        proxy_pass http://127.0.0.1:3000/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Add SSL with certbot:

$ sudo apt install certbot python-certbot-nginx
$ sudo certbot --nginx

Or Apache:

<VirtualHost *:80>
    ServerName notica.us

    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
    ProxyPreserveHost On

    ErrorLog ${APACHE_LOG_DIR}/notica-error.log
    CustomLog ${APACHE_LOG_DIR}/notica-access.log combined
</VirtualHost>

Apache SSL is left as an exercise for the reader :)

Process Control

I recommend using supervisor to auto-start and keep Notica running.

$ sudo apt install supervisor
$ sudo adduser --disabled-login --gecos '' --shell /bin/false notica
$ sudo chown -R notica:notica /opt/Notica

Add to /etc/supervisor/supervisord.conf or its own file:

[program:notica]
user=notica
directory=/opt/Notica
command=node server.js
autorestart=true
stopasgroup=true
killasgroup=true
stderr_logfile=/var/log/notica.log
stderr_logfile_maxbytes=10MB
stdout_logfile=/var/log/notica.log
stdout_logfile_maxbytes=10MB

Self-hosting with Docker

Build

docker build -t notica .

Run

docker run --rm -it -p 3000:3000 notica

With Traefik Reverse Proxy

docker run -d \
  --name notica \
  --restart unless-stopped \
  --label "traefik.enable=true" \
  --label "traefik.frontend.rule=Host:notica.example.com" \
  --label "traefik.port=3000" \
  --network traefik-network \
  -e TZ=Europe/London \
notica

License

This program is free and open-source software licensed under the MIT License. Please see the LICENSE file for details.

That means you have the right to study, change, and distribute the software and source code to anyone and for any purpose. You deserve these rights. Please take advantage of them because I like pull requests and would love to see this code put to use.

Acknowledgements

Thanks to welbert, damc-dev, scribblemaniac, and lukasmrtvy for their contributions.

notica's People

Contributors

damc-dev avatar dependabot[bot] avatar lukasmrtvy avatar scribblemaniac avatar tannercollin avatar welbert avatar

Stargazers

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

notica's Issues

Named channels

It would be nice to generate a fixed named channel by just opening the URL so I can actually use this URL for applications.

It doesn't make much sense to me with ephemeral IDs which can change and then every app has an outdated ID?

BabelLoader unexpected token

Using yarn on Ubuntu, with the supplied package.json, there seems to be a problem with the setup

jfr@dockerhost:~/docker/notica.dk$ yarn start --host 0.0.0.0
yarn run v1.22.17
$ yarn run build && node server.js --host 0.0.0.0
$ webpack --config ./webpack.production.config.js --profile --display-error-details --no-color
Hash: 0c34ed32dc97cdb5d755
Version: webpack 1.15.0
Time: 593ms
[0] multi main 28 bytes {0} [built] [1 error]
factory:0ms building:1ms = 1ms
+ 1 hidden modules

ERROR in ./src/index.js
Module build failed: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

BabelLoaderError: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

at transpile (/home/jfr/docker/notica.dk/node_modules/babel-loader/lib/index.js:61:13)
at Object.module.exports (/home/jfr/docker/notica.dk/node_modules/babel-loader/lib/index.js:163:20)

@ multi main
==> Listening on port 3000. Open up http://0.0.0.0:3000/ in your browser.

Any ideas ? The page is blank, when opening it.

Dockerfile

This fine piece of software deserves a good Docker container. I created one you can look at :-)

Persist notifications in localstorage

At least on Windows 10 with Chrome the notifications are short lived and it would be great if they could be stored in localstorage so you can see a history of the notifications.

I created a very barebones implementation of what this might look like and deployed it to Heroku. You can check it out at https://shielded-falls-16855.herokuapp.com.

If your interested in this as a feature of Notica let me know what you would like to see to get it included!

Here is the branch:
https://github.com/damc-dev/Notica/tree/notification-localstorage

alias not found in zsh

I'm not sure how I'm supposed to add notica() { curl --data "d:$*" "https://push.alarm.moon/?ID" ; } to my .zshrc and make it work

Notica app

"No installation"

On mobile notifications don't come through when browser app is not open. Would a minimalistic app be toleratable? Insert link and go.

Having slight issues with install on arch with nginx

I have nginx and yarn installed. trying to use the suggested nginx config is giving me 502's and errors. And when I'm not getting 502's I get Unable to connect to the Notica server. Attempting to reconnect....

Are there any deps I should have in addition to yarn and nginx? And Can I get away without running yarn start?
I'm trying to have this running on a small box to push notifications to my desktop when tasks on my server are done.

Docker dependencies

Running in Docker does not work. There are unmet dependencies, and errors when starting the container.
Any bright minds, that can solve this ?

Sending build context to Docker daemon 392.7kB
Step 1/8 : FROM node:13-alpine
---> 8216bf4583a5
Step 2/8 : COPY / /notica/
---> baebb5bb2e6e
Step 3/8 : WORKDIR /notica/
---> Running in e0f866c0be84
Removing intermediate container e0f866c0be84
---> 0d72515af127
Step 4/8 : RUN addgroup -S notica && adduser -S notica -G notica && apk add -U tzdata tini && yarn --ignore-platform install && chown -R notica:notica /notica/ && chmod +x /notica/entrypoint
---> Running in 176fb3968a70
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/2) Installing tini (0.18.0-r0)
(2/2) Installing tzdata (2021e-r0)
Executing busybox-1.31.1-r9.trigger
OK: 11 MiB in 18 packages
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning " > [email protected]" has unmet peer dependency "eslint@>=0.8.0 || ~1.0.0-rc-0".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning "webpack-dev-server > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
Done in 20.42s.
Removing intermediate container 176fb3968a70
---> 9101c9dd0c73
Step 5/8 : USER notica
---> Running in 791bd45abd86
Removing intermediate container 791bd45abd86
---> 735e01afd0df
Step 6/8 : EXPOSE 3000
---> Running in 14f3ec20215b
Removing intermediate container 14f3ec20215b
---> eadfd0613cfc
Step 7/8 : ENTRYPOINT ["tini", "--", "/notica/entrypoint"]
---> Running in 2ad260125b63
Removing intermediate container 2ad260125b63
---> e4e89c5ac7a9
Step 8/8 : CMD ["yarn","start","--host","0.0.0.0","--port","3000"]
---> Running in ea117e5f8138
Removing intermediate container ea117e5f8138
---> 7c3b6b25767f
Successfully built 7c3b6b25767f
Successfully tagged notica:latest

When starting the container:

docker run --rm -it -p 3000:3000 notica

yarn run v1.22.4
$ yarn run build && node server.js --host 0.0.0.0 --port 3000
$ webpack --config ./webpack.production.config.js --profile --display-error-details --no-color
Hash: 0c34ed32dc97cdb5d755
Version: webpack 1.15.0
Time: 620ms
[0] multi main 28 bytes {0} [built] [1 error]
factory:0ms building:1ms = 1ms
+ 1 hidden modules

ERROR in ./src/index.js
Module build failed: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

BabelLoaderError: SyntaxError: Unexpected token (6:1)

4 |
5 | React.render((

6 |
| ^
7 |
8 |
9 | ), document.getElementById('root'));

at transpile (/notica/node_modules/babel-loader/lib/index.js:61:13)
at Object.module.exports (/notica/node_modules/babel-loader/lib/index.js:163:20)

@ multi main
==> Listening on port 3000. Open up http://0.0.0.0:3000/ in your browser.

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.