如何添加软件更新订阅

发布于 2024-10-25 04:10:58 字数 213 浏览 4 评论 0原文

我们希望为我们的产品添加自动更新或更新通知(C++)。

更新应基于订阅:

  • 用户购买订阅期为 1 年的更新,
  • 当订阅到期时,不再有可用的更新。

有人可以推荐用于实施此类服务的软件或提供商吗?

我找到了一些自动更新的例子,但它们都是没有时间限制的。

该服务必须基于每个用户进行限制并允许扩展。

We want to add auto-update or update notification to our products (C++).

Update should be subscription-based:

  • user buys subscription for 1 year of updates
  • when subscription expires, no more updates are available.

Can someone suggest software or provider for implementing such a service?

I found a few examples of auto-update but they all are unlimited in time.

This service must be limited on per-user basis and allow extensions.

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

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

发布评论

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

评论(1

浅紫色的梦幻 2024-11-01 04:10:58

就成分而言,您需要的是:

  • 一种下载更新的方法 - 我建议使用 HTTP(S) 一种对
  • 许可证进行编码的方法,包括您有权获得哪种更新以及您可以使用多长时间我们有权获得它。理想情况下,这对用户来说是不透明的,但两端都可以轻松验证(因此可以将错误的条目通知给用户,而无需联系服务器),
  • 是一种了解更新是否可用以及何时再次检查的简单方法

这 我建议使用可嵌入的 HTTP 客户端定义一个简单的 XML over HTTP 服务,例如(无耻的插件) Arachnida,具有一个简单的 API - 类似于:

class UpdateAgent
{
/* boilerplate */
public :
    /* set the key to use. Throws an InvalidKey exception if not valid
     * validity is checked locally - no HTTP queries are used.
     * Key may have been invalidated on the server without notification
     * at this point */
    void setKey(const std::string &key);
    // Get the key currently set
    std::string getKey() const;
    /* using a synchronous HTTPS query, check with the server if updates are
     * available for the current key. Throws on error: one of the QueryError
     * subclasses if there has been a query error, or InvalidKey is the
     * key is either not set or is not valid (i.e. invalidated server-side) */
    bool isUpdateAvailable() const;
/* etc. */
};

如上所示,它们的密钥本身是一个字符串,通过其编码,将包含某种有关其有效性的信息 - 例如某种 CRC了解输入的字符串是否有效。密钥的其余部分(包括其到期日期)可以在服务器端进行管理,尽管到期信息也可以编码在密钥本身中(但这意味着如果用户延长许可证,则需要更改密钥)。

对于服务器端,当出现密钥和更新请求时,服务器将

  1. 检查密钥的有效性
  2. ,检查密钥所针对的软件是否有可用的更新(信息可能是也可能不是一部分)密钥本身的名称,具体取决于您是想在数据库中管理它还是希望它成为许可证密钥的一部分)
  3. 将文件复制或硬链接到可以下载的位置,并使用唯一且难以猜测的名称
  4. 向客户端提供下载的 URL - 例如,在为 HTTP 请求返回的 XML 流中
  5. 在 N 秒/分钟/小时内未下载文件后启动超时以删除文件
  6. 下载后删除文件由客户端

如果下载失败,可以重新启动或再次请求。如果您想对单个下载收费,则需要客户端确认下载成功 - 或报告失败错误 - 这样您就不会两次计算单个下载。

当然,这一切都不是我的想法——可能有一些细节我没有想到。每种成分都很容易获得。 Arachnida 的开源版本可以在 SourceForge 上获取,如果您需要的话,我有一些代码可以对许可证密钥进行编码(使用它适用于我的另一个产品),但我确信如果您不想使用我的产品,您可以这样写。

您可能需要考虑的一些事情是对您的客户端进行安全身份验证 - 这样他们就不会共享许可证密钥 - 保护您的 HTTP 连接,这样您最终就不会向全世界发布您的更新,等等。无论是服务器还是客户端客户端的实现需要非常复杂,因为大多数构建块已经存在。

HTH

RLC

What you would need, in terms of ingredients, would be:

  • a method to download the updates - I would suggest HTTP(S) for that
  • a method to encode the license, including what kind of updates you're entitled to and how long you're entitled to it. Ideally, this would be opaque to the user but easily verifiable on both ends (so an erroneous entry can be notified to the user without having to contact the server)
  • an easy way to know whether updates are available, and perhaps when to check again

What I would suggest would be to define a simple XML over HTTP service using an embeddable HTTP client, such as (shameless plug) Arachnida, with a simple API - something like:

class UpdateAgent
{
/* boilerplate */
public :
    /* set the key to use. Throws an InvalidKey exception if not valid
     * validity is checked locally - no HTTP queries are used.
     * Key may have been invalidated on the server without notification
     * at this point */
    void setKey(const std::string &key);
    // Get the key currently set
    std::string getKey() const;
    /* using a synchronous HTTPS query, check with the server if updates are
     * available for the current key. Throws on error: one of the QueryError
     * subclasses if there has been a query error, or InvalidKey is the
     * key is either not set or is not valid (i.e. invalidated server-side) */
    bool isUpdateAvailable() const;
/* etc. */
};

They key itself would, as seen above, be a string that, through its encoding, would contain some kind of information as to its validity - e.g. some kind of CRC to know whether the entered string is valid. The rest of the key - including its expiration date - could be managed server-side, although expiration information could also be encoded in the key itself (but that would mean changing the key if the user extends the license).

As for the server-side, when presented with a key and a request for an update, the server would

  1. check the validity of the key
  2. check whether any updates are available for the software the key is for (information that may or may not be part of the key itself, depending on whether you want to manage it in a database or want it to be part of the license key)
  3. copy or hardlink the file into a place it can be downloaded, with a unique and hard-to-guess name
  4. provide the URL for download to the client - e.g. in an XML stream returned for the HTTP request
  5. start a time-out to remove the file after it hasn't been downloaded for N seconds/minutes/hours
  6. remove the file once it has been downloaded by the client

If a download fails, it can be restarted or asked for again. If you want to charge for individual downloads, you'd need the client to confirm a successful download - or report an error on failure - so you don't count individual downloads twice.

Of course, all this is off the top of my head - there might be some details I haven't thought of here. Each of the ingredients are pretty easy to come by. An open source version of Arachnida is available on SourceForge and I have some code to encode license keys if you need it (used it for another of my products), but I'm sure that you can write that if you don't want to use mine.

A few things you might want to think of are secure authentication of your clients - so they don't share license keys - securing your HTTP connection so you don't end up publishing your updates to the world, etc. Neither the server nor the client need be very complicated to implement, as most of the building blocks already exist.

HTH

rlc

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