Results 1 to 3 of 3
Like Tree2Likes
  • 1 Post By jonwise80
  • 1 Post By Far Haddad
  1.    #1  
    This is going to be a long post, and probably won't interest most folks, but its close to a killer app for me, and I thought I'd share.

    TL;DR -- You can use SimpleChat and the related service to monitor almost anything on the web/your home network from any webOS device

    SimpleChat Back-End

    SimpleChat is just that, its simple. It has limited (almost no) security, no identity, and no encryption (at least in the public deployment.) It was designed so that retro device users could post simple public messages. That said, the resulting API ended up being remarkably similar to Discord's own API. So similar in fact, that it was (almost) trivial to integrate SimpleChat with a Discord server via a Bot.
    The message log is a JSON file, and read/write access is brokered through some RESTful PHP end points -- post, get, update, like. The PHP does some input scrubbing to make sure no one is sending malicious content, and some output filtering, to avoid exposing edit tokens to the wrong users. Everything is instance specific, and driven-by a config file.

    The Discord bot is a little more secure, and almost as simple. If configured, the PHP endpoints forward received input over (an ideally local) http interface to the bot so it can update Discord. The bot listens for Discord events on the configured server and channel, and writes directly to the message log JSON file. Everything is instance-specific, and driven by a config file.

    SimpleChat Front-End

    The webOS client started very simple, but has grown increasingly sophisticated. It translates modern Emojis to equivalent webOS emoticons or an image file, if there's no equivalency. It knows which messages belong to you so you can edit them. And it knows when its in the foreground/background/closed and performs appropriate updates and notifications for its state. And as of yesterday, everything is server-instance-specific and driven by a config file.

    So What?

    What all of this means is that you can spin up a new SimpleChat server in minutes, and you can roll your own SimpleChat-derived webOS app in seconds. Literally, you can have an all new app that serves a different (but message-based) purpose with just these actions:
    • Clone the SimpleChat app repo
    • Create a folder for your app and copy the root contents of the SimpleChat app repo into it
    • Create symlinks in your app folder pointing to the subfolders of the SimpleChat app
    • Overwrite the icons in your app folder with some of your own to make the app look unique
    • Update the appinfo.json to name your app and point to your SimpleChat server instance
    • Copy secrets-sample.json to secrets.json and add the client-id you configured on your server
    • From a command line "palm run ." inside your app folder

    That's it -- your new app will start running and pulling from and posting to your server. When I update SimpleChat, just git pull the SimpleChat app and repeat the last step above, and your app will magically be updated too!

    Some use cases are obvious: A semi-private chat room (make it more private by adding a SSL cert and using HTTPS, rename index.php in the server directory) is easy. But the killer app for me is using it as a way to monitor work from anywhere...

    As a Monitoring Service

    Because its so easy to create a new instance and app without code, I can spend my code writing time adding other interesting things to my message log. Some things I'm working on:
    • Monitor my Dev community Discord server for new messages (the Discord bot can do this already!)
    • Get PushOver notifications from my Raspberry Pi to my webOS phone
    • Check the state of our deployed fleet of servers and get notifications on webOS if something goes down
    • Get notifications via IFTTT from basically any modern web service

    With the index.php enabled, I can even monitor messages from other retro machines -- basically anything with a web browser.

    Some Caveats

    The Discord bot is now a separate repo GitHub, and is optional. If you don't install it, and don't change the config to point to it, it won't be used.

    Nothing about SSL-bumping via a proxy is secure. In fact, doing that effectively strips security out and some countries don't allow it.

    Because its not secure, I'd never put anything sensitive on this channel "A server is down" or "A developer asked a question" are not risky messages from my perspective. I won't be using a "private" SimpleChat server to post customer information, or talk about finances with my wife. Obviously if you use this, make smart choices about how and what.

    Still, all that aside, as a way to get info to my Pre3 as a daily driver -- things that prompt me to go find a modern computer if I need to -- its super handy. Hopefully it helps someone else out there keep their webOS devices useful.

    Everything is Open Source, and I'll update the docs as I go:
    - Front end: https://github.com/codepoet80/webos-simplechat
    - Back end: https://github.com/codepoet80/simplechat-service
    - Discord bot (optional): https://github.com/codepoet80/simplechat-discordbot
    Last edited by jonwise80; 04/16/2021 at 04:33 PM.
    Check out my webOS archival and development projects: http://www.jonandnic.com/webos | Like my apps? Why not buy me a coffee?
    Shuswap likes this.
  2. #2  
    This is amazing! Thank you for sharing
    jonwise80 likes this.
  3.    #3  
    Here's Nomad's Docker container to simplify server-side setup:

    https://hub.docker.com/r/h8pewou/simplechat-service

    And the (entirely optional) Discord bot:

    https://hub.docker.com/r/h8pewou/simplechat-discordbot
    Check out my webOS archival and development projects: http://www.jonandnic.com/webos | Like my apps? Why not buy me a coffee?

Similar Threads

  1. Discord + SimpleChat
    By jonwise80 in forum webOS Discussion Lounge
    Replies: 1
    Last Post: 04/27/2021, 07:49 AM
  2. SimpleChat - A New Way to Stay in Touch with the webOS Community
    By jonwise80 in forum webOS Apps & Games
    Replies: 5
    Last Post: 04/21/2021, 07:17 PM
  3. Replies: 4
    Last Post: 11/12/2020, 09:49 AM
  4. Whats Shaking and TechTray - back as Web Apps!
    By cyberprashant in forum webOS Apps & Games
    Replies: 2
    Last Post: 03/16/2020, 10:36 AM
  5. Link is expired - need help to log in to webosnation.com
    By qubag in forum webOS Apps & Games
    Replies: 4
    Last Post: 11/03/2019, 09:13 PM

Posting Permissions