Kasts è un'applicazione per podcast che gira su Linux. È sincronizzabile con gpoddersync su cloud.mastodon.uno https://castopod.it
Go to file
Jose Flores 58032dd560 Doesn't add width to an html img without a width defined
This attempts to fix the issue described here: https://invent.kde.org/plasma-mobile/kasts/-/issues/20

There seemed to be a loop that occurs when setting an img width which causes the view to re-render which causes the window to grow which goes back to setting an img width causing an loop that keeps growing the img width and eventually crashing.

There are a few ways to fix this but I believe not setting a width on an img without a width both fixes it and behaves as expected (see context section). I'm not sure if this is a solution Kasts wants to go with but at the very least it adds more details to the issue. 

## Reproducing
The gist of that issue is that a crash occurs when you visit https://feed.zugfunk-podcast.de/podcastrss.xml, episode 53 and this is reproducible. 

I was able to get to the bottom of why that particular podcast episode crashes and can be reproduced with the following content

```html
<table style=\"width:30rem;\"><tbody><tr><td style=\"width:14rem;\">Some Text On Left </td><td><img src=\"https://invent.kde.org/plasma-mobile/kasts/-/raw/master/icons/128-apps-kasts.png\"></td></tr></tbody></table>
```

*(can repro by setting this string as a QStringLiteral in Entry.cpp, line 64 when the content is first set and then clicking on any episode)

## Context
The problem seems to be with `<img`s that don't have a width set. In those cases the code tries to set the image to the width of the component. The problem with this seems to be that this assumes that these images are on their own horizontal line and that they should take the whole width. So to repro (see content I used to repro above as an example):
* put an image tag next to some element that takes some width (like a table where there's a left column with some text and a right column in the right)
* img tag without a width

What ends up happening is that the `img width` gets updated to the size of the component width but because there's another element to the left of it, it will mean that the resulting view is bigger than the component width which causes `onWidthChanged`(`EntryPage.qml::88`) to be triggered and the `adjustedContent` function to be called again where this whole process happens again (img width is updated to component width -> rendered but it's larger than width -> causing onWidthChanged -> adjustedContent runs again -> rinse/repeat).

There are other ways to try to solve this but the three I looked at are: 
1. After `adjustedContent` is run, it should update the actual `m_content` so that the following runs can work off the last text update (this will mean that the problematic `else` wouldn't be run constantly).
    * You can do this by setting the content at the end of the function (`setContent(ret);`)
2. Checking for some reasonable width limit (if width > 10000 then width = 10000)
3. Not resizing an image without a width because we're not sure about the intention of the author 
    * in this case these were small icons for social media that shouldn't be scaled up
    * I think we shouldn't scale any images because of the same reason but the PR is conservative and just stops it in the case of a img without a width

For the PR I went with # 3 because the others led to the icons being scaled but it messed up the look of the page.

Closes #20
2022-08-08 11:10:51 +00:00
.reuse Add app icons for windows build 2022-06-30 20:23:34 +00:00
LICENSES Implement network status checking on android 2021-10-09 19:32:28 +00:00
android Properly apply version to AndroidManifest 2022-06-01 21:16:42 +02:00
icons Add app icons for windows build 2022-06-30 20:23:34 +00:00
po GIT_SILENT Sync po/docbooks with svn 2022-08-08 01:57:38 +00:00
src Doesn't add width to an html img without a width defined 2022-08-08 11:10:51 +00:00
.editorconfig Add more license information 2021-05-12 13:43:49 +02:00
.gitignore Add compile_commands.json to .gitignore 2021-10-03 19:08:09 +02:00
.gitlab-ci.yml Use proper reuse CI job 2022-04-26 00:17:45 +02:00
.kde-ci.yml Use multithreading for feed updates (using ThreadWeaver) 2022-05-29 15:22:23 +02:00
CMakeLists.txt Add app icons for windows build 2022-06-30 20:23:34 +00:00
README.md Use multithreading for feed updates (using ThreadWeaver) 2022-05-29 15:22:23 +02:00
kasts-android-square.svg Add png renders based on new SVG and add license attribution 2021-05-26 12:17:45 +02:00
kasts.svg icon with higher contrast 2021-05-26 10:25:04 +02:00
logo.png Add png renders based on new SVG and add license attribution 2021-05-26 12:17:45 +02:00
org.kde.kasts.appdata.xml GIT_SILENT made messages (after extraction) 2022-08-04 00:48:06 +00:00
org.kde.kasts.desktop SVN_SILENT made messages (.desktop file) - always resolve ours 2022-07-10 01:52:32 +00:00

README.md

Kasts

Kasts is a convergent podcast application.

Download on Flathub

Get it

Nightly Android APKs are available at KDE's Binary Factory.

Building

Note: When using versions of kasts built from git-master, it's possible that the database format or the name of downloaded files change from one version to another without the necessary migrations to handle it. If you notice bugs after upgrading to a git-master version, export your feeds, delete ~/.local/share/KDE/kasts and import the feeds again.

Requirements

  • KCoreAddons
  • KI18n
  • KConfig
  • Kirigami
  • Syndication
  • TagLib
  • QtKeychain
  • ThreadWeaver

On debian

 apt install build-essential cmake extra-cmake-modules qtbase5-dev \
    qtdeclarative5-dev qtquickcontrols2-5-dev qtmultimedia5-dev \
    libkf5syndication-dev libkf5config-dev libkf5i18n-dev \
    libkf5coreaddons-dev libtag1-dev qtkeychain-qt5-dev \
    libkf5networkmanagerqt-dev libkf5threadweaver-dev

Linux

git clone https://invent.kde.org/plasma-mobile/kasts
cd kasts
mkdir build && cd  build
cmake .. -DCMAKE_PREFIX_PATH=/usr
make
sudo make install

This assumes all dependencies are installed. If your distribution does not provide them, you can use kdesrc-build to build all of them.

Android

You can build Kasts for Android using KDE's Docker-based build environment.