top | item 33109513

Zerocal – A Serverless Calendar App in Rust

154 points| omn1 | 3 years ago |endler.dev

58 comments

order

spdustin|3 years ago

I want to make sure I understand this:

You made a VCALENDAR generator with a web-accessible endpoint. It fills in the VCALENDAR with info passed in via URL parameters. And rather than returning a webpage, it just returns the VCALENDAR file.

So you send your friends the link, they click it, rather then returning text/html content, it returns a downloadable response consisting of a pre-filled VCALENDAR file with the correct MIME type, and .ics extension.

Do I have that right?

omn1|3 years ago

That's correct.

aaaaaaaaaaab|3 years ago

Do you even need a service for this? Couldn't this be a simple static HTML + minimal JS that opens a base64 URL with content-type "text/x-vcalendar"?

omn1|3 years ago

Author here, had a lot of fun building this as it's just ~100 lines of Rust code + some CSS/HTML. If someone is looking for a fun thing to contribute to during Hacktoberfest, the code is on Github: https://github.com/mre/zerocal Will mainly use it for myself to send out event links to friends.

schemescape|3 years ago

FYI: the text on your blog post is cropped on my small screen (iPhone SE), and scrolling doesn’t even help, so its essentially unreadable.

yewenjie|3 years ago

Can it be self-hosted without relying on shuttle.rs? If yes, could you please update the readme with instructions?

belkarx|3 years ago

The process for making webapps in Rust seems extremely clean compared to other languages (or maybe I'm not exposed enough but I remember making things with Golang and even just JS was torture with common hosting solutions). Props to shuttle.rs and the Rust community!

tomcam|3 years ago

> I remember making things with Golang… was torture with common hosting solutions)

What made it difficult to deploy Go apps?

tuukkah|3 years ago

> I wanted a way to create calendar entries from my terminal.

> There is no state on the server, it just generates a calendar event on the fly and returns it.

Didn't see that coming. I suppose it's handy that you can call it anywhere curl is installed (or even use the browser address bar as your command line) instead of having to install and run the Rust program locally.

tuukkah|3 years ago

I seem to have missed the author's point which is to craft the link and send the link to others to download.

hoducha|3 years ago

Why do we need a vCalendar file generator? The output of your app is a vCalendar file which is then imported into a Calendar app either manually or through the integration of email and calendar services. So in the end, people still have to use a calendar app. It is much easier to create an event on a calendar app and send the invitation which is actually sending emails with a vCalendar file as an attachment. Besides that, most calendar apps allow exporting the event as a vCalendar file also.

longrod|3 years ago

Looks cool but...why not just send the .ics file directly via your IM of choice? Am I missing something here? I don't see the benefit if you still have to click, open file in your calendar, add it to the calendar.

Can you tell me why the above wouldn't work and why this is better?

omn1|3 years ago

You could do that but you'd have to create the ics file manually and not every platform allows you to share ics files. My original use-case was Github. Wanted to share invites for https://github.com/hello-rust/community. Github prevents sharing ics. Another thing is that people could edit a link in-place to e.g. update the time without creating a new file.

jacob019|3 years ago

Speaking of zerocal, have you ever noticed that low calorie packaged foods like pickles and cauliflower will put tiny serving sizes on the package so they can advertise 0 calories? I think they round down to zero when it's less than 5 calories.

EmbeddedHash|3 years ago

Yep. Another suspect of this is cooking oil spray, like Pam. They can advertise very low calories, usually 0, per serving but a serving is considered like 1/3 of a second spray.

clircle|3 years ago

I'm wondering if this or a similar tool could be hooked into emacs to make working with calendars in emacs a bit easier. I don't think there is a good way to send calendar invites to people from emacs (but happy to be wrong on this one).

tuukkah|3 years ago

As seen in the article, the invites are simple text files. (I haven't tried, but you might be able to create one with icalendar-export-region?)

I think the more difficult part is sending an email that looks and works right with the invite attached in a way compatible with the receiving systems.

Invitations from Microsoft systems are especially horrible as they look like normal, plain text messages (without an invite) in standards-compliant systems. Depending how the sender expresses themselves, the receiver might have no clue they were invited let alone the time and place.

simlevesque|3 years ago

I beg you to keep GET requests idempotent. It's not that hard.

10000truths|3 years ago

There’s no state maintained on the server, so all requests made to it are idempotent.

ibotty|3 years ago

Maybe I am missing something, but which GET is not idempotent?

fny|3 years ago

Don't be a party pooper. This is just RPC via HTTP. ;)

jonathankoren|3 years ago

Given that this just creates an ics file, why bother with a server at all?

tuukkah|3 years ago

Apparently, to craft and send the link rather than the file.