DownloadHelper.downloadTextContent

This hook has nothing to do with privacy. It fixes the "Explain xkcd" feature of the "xkcd Browser" (com.floern.xkcd) app version 4.2 (24). "xkcd Browser" is a fine app, but it hasn't been maintained in a while and the "Explain XKCD" feature is broken and shows a 301 HTTP error. This hook will fix the "Explain XKCD" button. Note that this hook will only show up for and can only be applied to the "xkcd Browser" app version 4.2 (24). Instructions: 1. Download this hook. 2. Make sure that the Fif collection is enabled in XPL Pro. 3. In XPL, navigate to the "xkcd Browser" app, and expand the restriction categories. 4.a. Check the "Utilities" category. 4.b. Or, alternately, enable DownloadHelper.downloadTextContent hook for "xkcd Browser" in XPL Pro. Changelog: v1 - 2019-05-25 First public release.

CollectionFif
GroupUtilities
NameDownloadHelper.downloadTextContent
AuthorFif_ on XDA.
Version1
Updated (UTC)2019-05-26 04:13:50
Created (UTC)2019-05-26 04:13:50
Downloads302
Class namecom.floern.xkcd.utils.DownloadHelper
Method namedownloadTextContent
Parameter typesjava.lang.String, java.lang.String
Return typejava.lang.String
Min SDK1
Max SDK999
Min APK24
Max APK24
Excluded packages^(?!com\.floern\.xkcd$).*
EnabledYes
OptionalNo
UsageYes
NotifyNo
Settings-
-- DownloadHelper.downloadTextContent is a set of Lua hook definition
-- designed to work with XPrivacyLua.

-- DownloadHelper.downloadTextContent is free software: you can
-- redistribute it and/or modify it under the terms of the GNU General
-- Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version.

-- DownloadHelper.downloadTextContent is distributed in the hope
-- that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE.  See the GNU General Public License for more details.

function before(hook, param)
    local url = param:getArgument(0)
    local fake, replaced
    fake, replaced = url:gsub('^http:(//www.explainxkcd.com/wiki/index.php[?]title=)', 'https:%1')

    if replaced > 0 then
        param:setArgument(0, fake)
        return true, url, fake
    else
        return false
    end
end