Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.

Guide to patch Coldsweat to provide automatic feed fetch feature via a URL

Jiří Smolík edited this page Sep 27, 2018 · 20 revisions

Eventually, Coldsweat will have its own equivalent feature so this is a temporary hack, oblivious of user accounts (fetches anything and everything). As such, it also doesn't require user password before performing the fetch operation.

Anyway, prerequisites to this hack are:

  1. Install QColdsweat on your QNAP.
  2. Gain access to the files on your QNAP (e.g. SSH, sFTP and so on).
  3. Make yourself familiar with QColdsweat's folder structure.

Step 1

Add the following to <application-folder>/coldsweat/coldsweat/frontend.py:

@GET(r'^/feeds/fetch$')
def feed_fetch_all_now(self):
    if config.web.fetch_override:
        self.fetch_all_feeds()
        return self.entry_list()
    else:
        raise HTTPForbidden('This feature has not been allowed')

Note: keep the 4-space indentation. Otherwise, python will complain.

Step 2

There are two array definitions in <application-folder>/coldsweat/coldsweat/config.py:

DEFAULTS = {
    'min_interval' : '900',
    'max_errors'   : '50',
    'max_history'  : '7',
    'timeout'      : '10',
    'processes'    : '4',
    'level'        : 'INFO',
    'filename'     : '',
    'static_url'   : '',
    'load'         : ''
}

converters = {
    'min_interval' : parser.getint,
    'max_errors'   : parser.getint,
    'max_history'  : parser.getint,
    'timeout'      : parser.getint,
    'processes'    : parser.getint,
}

Add this to the DEFAULTS array:

'fetch_override'	 : 'no',

Add this to the CONVERTERS array:

'fetch_override' : parser.getboolean,

Step 3

Add the following to <data-folder>/config and into the [web] section:

; If enabled, all feeds will be re-fetched when 'http://<host>:<port>/feeds/fetch' is called, regardless of 'min_interval'.
fetch_override: yes

Step 4

Create a bookmarklet pointing to http://<host-or-ip-address-of-your-qnap>:3333/feeds/fetch in your browser. Once you use it, Coldsweat will re-fetch all feeds and then redirect you to the index page (where you can login or browse through the new articles).

Step 5

Restart the QPKG :). Equivalent to disable/enable operations in your App Center.