如何通过用户可以使用URL订阅的方式通过NodeJS API服务ICS文件?

发布于 2025-01-17 19:02:45 字数 494 浏览 1 评论 0原文

因此,我在Google Cloud Storage中将ICS文件放置,我想通过我的API提供它,因此我不必公开ICS文件。但是,我不确定正确的方法是什么,以便用户可以将我的API调用链接放在其Google日历中作为网络计算链接以订阅日历。

这是可能的还是我必须提供指向ICS文件的直接链接,以便用户能够订阅日历?如果可能的话,我该如何在nodejs中使用该文件?

例子: https://storage.googleapis.com/example/calendar.ics将能够通过 https://api.com/example/userid/calendars

webcal://api.com/example/example/userid/calendars在Google日历中使用

So I have my ics file in Google Cloud Storage and I would like to serve it through my API so I don't have to make the ics file public. However, I am not sure what is the right way to do that so that the user can put the link to my api call in their Google Calendar as a webcal link to subscribe to the calendar.

Is this possible or do I have to provide a direct link to the ICS file for the user to be able to subscribe to the calendar? If it is possible, how would I go about serving the file in NodeJS?

Example:
https://storage.googleapis.com/example/calendar.ics would be able to be served through https://api.com/example/userID/calendars

webcal://api.com/example/userID/calendars would then be used in the Google Calendars to subscribe to the calendar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花间憩 2025-01-24 19:02:45

因此,我有两个选择:

  1. 将对 ICS 文件的访问权限更改为公开,然后将该 URL 共享给用户。但是,如果我想要删除或更改文件名,此方法不允许我动态更改文件。
  2. 通过我的 API 提供 ICS 文件 - 这是我最初在原始帖子中询问的方法。

因此,对于方法 2,我基本上只需要执行 gcs.bucket('bucket_name').file('bucket 中 ics 文件的文件路径').download((error, content) => res.send(内容))

So I had two options available to me:

  1. Change the access to the ICS file to public then share that URL to the user. However, this method would not allow me to dynamically change the file in the case that I would want to delete or change the file name.
  2. Serve the ICS file through my API - the method I had originally asked about in the original post.

So for method 2, I basically just had to do gcs.bucket('bucket_name').file('file path to ics file in bucket').download((error, content) => res.send(content))

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文