Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C. Cassandra needs to be updated #89

Open
Ingvix opened this issue Aug 16, 2019 · 4 comments
Open

C. Cassandra needs to be updated #89

Ingvix opened this issue Aug 16, 2019 · 4 comments

Comments

@Ingvix
Copy link

Ingvix commented Aug 16, 2019

The current comic got from Tumblr often now shows only a preview of the comic and leaves the punchline out. Full comics can be found at https://tapas.io/series/CassandraComics.

@Maledictus
Copy link
Collaborator

I have a solution for cassandra comics but due to bug in Qt it will freeze application until comics download.
I can't take this decision myself. @tardypad What do you think about it?
Solution:

function(page) {
    var regex = /<a\sclass="ga-tracking\sjs-episode\s+"(.|\s)+?href="([^"]+)"/
    var match = regex.exec(page);
    var url = "https://tapas.io" + match[2]
    var xhr = new XMLHttpRequest();
    xhr.open("GET", url , false);
    xhr.send(null);
    if(xhr.status === 200)
    {
        var newPage = xhr.responseText;
        var regex2 = /<img\s*src="([^"]*)"\sclass="content__img"/
        var match2 = regex2.exec(newPage);
        return match2[1];
    }
}

@tardypad
Copy link
Owner

tardypad commented Mar 9, 2020

@Maledictus The javascript plugin is only supposed to extract the strip URL from a page. There shouldn't be any other logic like further requests.

AFAIR There would need to be more changes around the fetching/parsing logic in the C++ code to handle this properly.

I think C Cassandra should be removed for now. Last time I've checked (a long time ago) it wasn't possible to use comics from tapas.io in the app.

@Maledictus
Copy link
Collaborator

@tardypad I can do it on C++ side but I don't want to hardcode something comics-related in c++.

@tardypad
Copy link
Owner

tardypad commented Mar 9, 2020

Yes there shouldn't be such comic specific code in there.

What I mean is that if there is more logic in the Javascript than just parsing, there needs to be some more general changes in the C++ side:

  • the function is no more just a simple "extractStripImageUrl"
  • we should properly handle and reports network and other type of errors from the Javascript code
  • maybe other stuff I don't remember

I wouldn't introduce those complex changes just to fix a single comic. If there are more requests for comics that would require such a feature, then maybe it'd be justified.
And if the app freezes when doing such downloads in the Javascript, I think it's another good reason not to do it for now.

Olf0 added a commit to sailfishos-applications/daily-comics that referenced this issue Oct 2, 2023
Even though this fix was originally dismissed as not elegant, it is far better than a broken CCassandra plugin!  In general, I disagree with the notion that not everything reasonably feasible with JavaScript is allowed.  For details, see tardypad#89

Furthermore this scheme seems to be generically applicable to comic strips from `tapas.io`.
Olf0 added a commit to sailfishos-applications/daily-comics that referenced this issue Oct 2, 2023
Even though this fix was originally dismissed as not elegant, it is far better than a broken CCassandra plugin!  In general, I disagree with the notion that not everything reasonably feasible with JavaScript is allowed.  For details, see tardypad#89

Furthermore this scheme seems to be generically applicable to comic strips from `tapas.io`.
Olf0 added a commit to sailfishos-applications/daily-comics that referenced this issue Oct 15, 2023
* Add 7 comic strips: Gorilla, Hein de Kort, Lectrr, De wereld v. A. D., Schot, Tjeerd Royards, ZAK (#4)

* New cartoon: Lectrr
  Since Clay Bennett and der Spiegel Cartoon des Tages could enter the plugins with their political cartoons, I thought: why not Lectrr?

* Added plugin: Tjeerd Royaards
  Let's try again to get Tjeerd Royaards in, since political cartoons no longer seem to be banned. Supplying a large cover image is kind of difficult. Could we do it like this?

* New cover jpgs
  Why not?

* New cartoon: Hein de Kort
  Legendary cartoonist

* New cartoon: Zak
  Flemish cartoonist, unfortunately old cartoons

* 3 new cartoons
  Can't get enough!

* Swamp and Loading Artist
  Small changes

* [tjeerdroyaards/info.json] Shorten name

* [tjeerdroyaards/info.json] Do not use whiote as bg colour, but bg colour if the author's scetch

* [tjeerdroyaards/info.json] Use About page instead of https://tjeerdroyaards..com/

* [tjeerdroyaards/extract.js] Rectify RegEx

* [swamp/info.json] Improve weblinks

* [shot/info.json] Improve link, correct langauage and move to basvanderschot

* [basvanderschot/extract.js] Rename directory & improve RegEx

* [basvanderschot/example.jpg] Add new example image

* [pietergeenen/extract.js] Improve RegEx

* [pietergeenen/info.json] Alter homepage

* [lectrr/info.json] HTTPS Hompage

* [lectrr/extract.js] Fix extraction RegEx

* [lectrr/extract.js} Improve RegEx

* [lectrr/info.json] Align background colour

* [loadingartist/extract.js] Fix Regex and return value

* [loadingartist/info.json] Use HTTPS

* [gorilla/extract.js] Fix RegEx

* [gorilla/info.json] Fix authors

* [zak/extract.js] Enhance

* [zak/extract.js] Improve RegEx

* [tjeerdroyaards/extract.js] Improve RegEx

* [loadingartist/extract.js] Document absolute path without server prefix

* [heindekort/info.json] Rectify link

* [heindekort/extract.js] Improve RegEx

* [plugins] Added `gorilla/example.jpg` and moved `schot`

* [ccassandra/extract.js] Try fix from tardypad#89 (#31)
  Even though this fix was originally dismissed as not elegant, it is far better than a broken CCassandra plugin!  In general, I disagree with the notion that not everything reasonably feasible with JavaScript is allowed.  For details, see tardypad#89
  Furthermore this scheme seems to be generically applicable to comic strips from `tapas.io`.

* [vidadesuporte/extract.js] Optimise RegEx

* [README.md] Overhaul README

* [README.md] Fixes

* Create `.xdata/resources/plugins/bloomcounty` directory

* [README.md] More fixes

* Update LICENSE.txt

* [LICENSE.txt] Delete superfluous space character

* Update LICENSE.txt

* Update LICENSE.txt

* [LICENSE.txt] Add `nl` translation hint

* Update README.md (#33)
  - Use relative image links
  - Ads Contributors, translators and plug-in authors section
  - Minor changes

* [generate_list.sh] Overhaul

* [generate_covers_grid.sh] Overhaul

* [generate_list.sh] Beautify

* [generate_list.sh] Optimise slightly

* [generate_list.sh] Optimise `grep`ping

* [generate_list.sh] Use fgrep

* [generate_covers_grid.sh] Fix quoted in quoting

* [generate_list.sh] Normalise variable names

* [generate_covers_grid.sh] Do quote when potentially necessary

* [generate_covers_grid.sh] No need for `cat`

* [generate_covers_grid.sh] Add comment

* [generate_covers_grid.sh] … more commet.

* Clean up QML pages (#34)

* [AboutPage.qml] Clean up

* Delete `qml/scripts/ExternalLinks.js` helper functions

* [Constants.qml] Cleanse and update

* [ComicPage.qml] Omit deleted `../scripts/ExternalLinks.js`

* [ComicInfoPage.qml] Omit deleted `../scripts/ExternalLinks.js`

* [AboutPage.qml] Omit deleted `../scripts/ExternalLinks.js`

* [FavoritesPage.qml] Omit deleted `../scripts/ExternalLinks.js`

* [ImageOverlay.qml] Omit deleted `../scripts/ExternalLinks.js`

* [EndPanel.qml] Use specific article

* Update [ComicInfoPanel.qml] Omit deleted `../scripts/ExternalLinks.js`

* [harbour-dailycomics.qml] Add missing space

* [ComicItem.qml] Omit deleted `../scripts/ExternalLinks.js`

* [ImageOverlay.qml] "url" → "URL"

* [RequestContactDevRectangle.qml] Omit deleted `../scripts/ExternalLinks.js`

* [ZoomableImage.qml] Omit deleted `../scripts/ExternalLinks.js`

* [ComicInfoPanel.qml] Add copyright

* [ComicItem.qml] Add copyright

* [EndPanel.qml] Add copyright

* [ImageOverlay.qml] Add copyright

* [RequestContactDevRectangle.qml] Add copyright

* [RequestContactDevRectangle.qml] Remove extra, empty line

* [ZoomableImage.qml] Add copyright

* [harbour-dailycomics.qml] Add copyright

* [ComicInfoPage.qml] Add copyright

* [ComicPage.qml] Add copyright

* [FavoritesPage.qml] Add empty lines to align `QStr` fields

* [ComicItem.qml] Move added, empty line

* [ComicInfoPanel.qml] Move added, empty line

* [RequestContactDevRectangle.qml] Add empty line to align

* [ZoomableImage.qml] "Can't" → "Cannot"

* [AboutPage.qml] Add word "repository"

* [ComicItem.qml] Re-remove newline

* [ComicInfoPage.qml] Re-remove newline

* [ComicInfoPanel.qml] Re-remove newline

* [EndPanel.qml] Re-add neweline

* [RequestContactDevRectangle.qml] Re-remove newline

* [FavoritesPage.qml] Re-remove two newlines

* [ImageOverlay.qml] Move newline

* [StatusOverlay.qml] Adapt to deleted `../scripts/ExternalLinks.js`

* [ShareLinkPage.qml] Remoive superfluous newline

* [ShareLinkPage.qml] Add copyright

* [harbour-dailycomics.ts] Adapt and fix primary translations file (#35)

* Rename RequestContactDevRectangle.qml to ReportNewComicRectangle.qml

* [harbour-dailycomics.ts] RequestContactDevRectangle.qml → ReportNewComicRectangle.qml

* [harbour-dailycomics.pro] Remove stale references

* [harbour-dailycomics.pro] Add `rpmlintrc` file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants