Script Hosting For The Handy Devices [Self Hosting]

This is an open-source project for hosting a script for The Handy.

The target audience is for those who need to provide a script url for The Handy during /hssp/setup.

I expect this to be quite a niche topic, mainly for those that are developing around The Handy and specifically making use of The Handy protocols such as HSSP.

Why make this?

When working on the Mac app FunPlayer, I had to have a way to provide a publicly accessible URL to give to The Handy API /hssp/setup endpoint when a user selects a script so it could process the actions onto the device to be played in-sync.

The options were to use the Hosting API provided by Ohdoki or self-host.

I decided it was best to self-host to be in control of reliability/uptime and to be sure of the privacy measures in place.

Only the bare minimum required to store a script is stored, when a script is uploaded, only the actions are stored and the name is the SHA256 hash derived from the actions list.

The hash returned when requesting a script matches the hash the Handy expects in api V2 where if you provide a URL and hash in the script upload request, the handy can verify the hash and skip upload if the sha256 hash is provided AND the handy also hashes the actions array and agrees (a SHA256 hash that is not derived from the actions array can’t be provided, it is checked somewhere in the Handy API and will reject if the SHA hashes derived from the actions list are not in agreement).

The README.md file on Github goes into more depth of the gotchas and overview, etc.

5 Likes

Can’t wait to try this at home

1 Like

Just a heads up: You refer to the company as Sweet Tech AS on GitHub, but they’ve changed company name to Ohdoki AS.

1 Like

im really going to send a draft before live of anything I do going forward to you for a check :laughing:

love ya Rose, will get that edited on GitHub and my brain :slight_smile:

:slight_smile: I wonder of the other use cases / circumstances people will use this for

hopefully useful to more broader things than what I made it for.

I mean, theoretically this would be a way to keep functionality after the official Handy servers are dead, no?
If so, then something like this is incredibly valuable in case Ohdoki doesn’t make something like this for the community to maintain before they end official support.

2 Likes

hmm yeah to an extent.

this covers making a script available publicly.

The Handy servers that we need to connect our devices through is still private as far as I’m aware but one day if Ohdoki opens their server API for whatever reason, maybe an old API and they’re two generations ahead or business wants to go more open source whatever the case.

this piece solves for given a funscript file, make it available via a URL (and specifically in the CSV format that FW3 expects at least and I think works with FW4 as well, got to check)

From a quick glance my first thought is of a way to integrate it in my docker stack as permanent/offline script host for Jellyfin/Emby/Plex webhooks via plugin.

Also could be an excellent way for various services to experiment with self-hosting handy servers to improve latency by cutting out the middleman, though that would depend a lot on how optimized the queries are compared to handy hosted backends.

1 Like

your first use case sounds interesting, I don’t have that much experience to give my opinions in regards to it.

in re your second point, I believe that right now when a script is uploaded via The Handy servers, it’s stored in an S3 bucket and retrieved from there.

Using an in-memory store such as Redis is definitely much quicker than retrieving from S3.

Although again the time to travel to that Redis server is still something to consider as well.

Right now for my use case, I use Upstash Redis in a single area, and a Cloudflare worker to write to and retrieve from Upstash Redis.

1 Like

you might find this post interesting as well:

1 Like