this post was submitted on 24 May 2025
28 points (100.0% liked)

Selfhosted

46676 readers
268 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Partially Solved

While I haven't found a native solution on how to integrate NTFY to glance, I did build up something that actually send basic text streams to glance in an automated way. It's very rudimentary and probably error prone, but that's the best I could do right now... Maybe someone else will chime in and give some better advice/solution.

For those interested postgREST allows to build a simple docker container postgres database you can query for the custom api in glance. It DOES work, but If like myself, your database/json/postgre knowlege is very limited, it only allows basic text response like: "Update Failed".

I did try to get a little further into the rabbit hole, but it does come with the necessity to have a good database and query/response background ? Not a very good solution and will probably not go one or try to improve on that right now... But feel free to give better advice or another lead to follow :)

Further notes:

On a final note, I do see a lot of interest in the Glance community and alot of new and interesting updates:

  • Added .Options.JSON to the custom API widget which takes any nested option value and turns it into a JSON string v0.8.3
  • [Custom API] Synchronous API calls and options property v0.8.0

Hello everyone !

I kinda hit a roadblock here and I'm interested if someone actually have done something similar or an alternative to what I'm trying to achieve.

Some background

Right now I'm playing around with NTFY and works great. I even hooked some automated backup script to my server with stdout/stderr output:

(Please, no bash-shaming ! :P)

#!/bin/bash

$COMMAND

if [ $? -eq 0 ]; then
        echo "Success"
        issue=$(<stdout.txt)
        curl -H "Title: Hello world!" -H "Priority: urgent" -d "$issue" https://mydomain/glancy

else
        echo "Failure"
        issue=$(<stderr.txt)
        curl -H "Title: Hello world!" -H "Priority: urgent" -d "$issue" https://mydomain/glancy

fi

This works great and I receive my notification on every device subscribed to the topic

What I'm trying to achieve?

Send the NTFY notification to a visual dashboard like Glance. If there's no native way to achieve this, self-host a simple json api that get's populated by my server's script response?

What's the issue ?

After skimming all the GitHub repos, there's no mention on any self-hosted dashboard to integrate NTFY as a notification hook. I find it kinda strange because NTFY is just a simple HTTP PUT or POST requests so It should be rather easy no?

And after searching the whole day on the web, there wasn't any good results or resources. So I came to the conclusion that It wasn't that easy and probably needs a bit more of something I'm probably bad at (coding?).

In the glance documentation there's configuration to hook a custom api and looks rather simple, however now I hit a roadblock I'm not able to solve... I have no idea where or how to spin up a self-hosted and dynamic json api that communicates with my server and updates/populate that json file... Here's an example to show what I mean:

Json api: https://api.laut.fm/station/psytrancelicious/last_songs

Custom Glance API template:

- type: custom-api
  title: Random Fact
  cache: 6h
  url: https://api.laut.fm/station/psytrancelicious/last_songs
  template: |
    <p class="size-h4 color-paragraph">{{ .JSON.String "title" }}</p>
Questions

  1. Any native way to hook NTFY's notification to a dashboard like instance (Glance, Homer, Dashy?)

  2. If no, Is it possible to self-host a json api that gets populated by my script's response? A good pointer to the right direction would be very nice, preferably a Docker solution !

  3. Another solution to have a visual dashboard (not the native NTFY dashboard) and visualize all my script response notification in one place ?


Thank in advance for all your responses :) and sorry for my bad wording, web development terminology is not really my cup of tea !

you are viewing a single comment's thread
view the rest of the comments
[–] rumba@lemmy.zip 2 points 5 hours ago (1 children)

I'm glad to hear you got it worked out.

You can use copilot for free, you don't have to install anything just creating an account, you can do it in a vanilla browser They don't even really get that much good information off of you.

For learning something that you've never done before it's honestly pretty damn good of all the horrible things AI is used for this is one of the least detrimental.

Just remember if you do use it for anything don't just copy and paste willy-nilly read it, use it to understand things. Some of the data it's trained on are jokes telling people to delete their hard drives.

[–] N0x0n@lemmy.ml 1 points 1 hour ago

Thanks for the pointer !

Just remember if you do use it for anything don’t just copy and paste willy-nilly read it, use it to understand things. Some of the data it’s trained on are jokes telling people to delete their hard drives.

Haha yeah ! I Always try to understand a command before I copy/past anyway, especially since I learned there can be hidden code execution when copy/pasting... Kinda scary shit !