tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

Instant View support

Open Marocco2 opened this issue 9 years ago • 33 comments

Please add support to IV articles image

Marocco2 avatar Jun 05 '17 18:06 Marocco2

Instant view was made to provide ease of access using built in browsers in each operating system. Telegram desktop is built to be multi platform so if they want to add it they may need to include some kind of browser which I don't think would be easy. Safari and Firefox already provide a similar function.

MikeMazalahi avatar Jun 12 '17 06:06 MikeMazalahi

@MHTE Instant view is not in HTML -- it's in tg's special format. However, IV pages can have "iframe" like parts -- for youtube, twitter, and a couple of other selected sites. So it is possible to render IV pages without a browser.

stek29 avatar Jun 12 '17 08:06 stek29

yes please ,,,,why don't you ask durov on telegram to implement it ??

elswerky avatar Jul 31 '17 13:07 elswerky

@elswerky because it'll be very annoying for Durov? Problem with instant view are embeds, which would require TDesktop to either have a bundled browser (hi issues, vulns, even more complicated build process and larger binary size), or to handle API of every service which can be embedded (even worse)

stek29 avatar Aug 01 '17 01:08 stek29

Instant view works well on telegram desktop for MacOS. But doesn't work in windows desktop client. Screenshot from first post shows, how it looks on windows client.

simple-elf avatar Oct 13 '17 11:10 simple-elf

@simple-elf no, it doesn't work on Telegram Desktop for macOS, only on Telegram native macOS app which is different from Telegram Desktop.

stek29 avatar Oct 13 '17 12:10 stek29

@AntonBoch1244 No, that's not how IV works. You're very very wrong.

IV is generated on server side.

But embeds will be painful. That's the only problem -- embeds in IV are normal web pages, which have to be parsed and displayed by client.

stek29 avatar Oct 13 '17 14:10 stek29

@stek29 i check how IV works. And drop my comments, as well. Because fully wrong answer(including step-by-step on server side) in my now removed comments.

AntonBoch1244 avatar Oct 13 '17 15:10 AntonBoch1244

Maybe this can help to implement IV: http://doc.qt.io/qt-5/qtwebview-minibrowser-example.html

Aokromes avatar May 17 '18 12:05 Aokromes

Qt WebView can't be statically build, so no way for now...

kirsan31 avatar May 17 '18 20:05 kirsan31

iv of this issue image

Piterden avatar May 17 '18 20:05 Piterden

Qt WebView can't be statically build, so no way for now...

So I think Telegram should implement an instant view site that gets the link to a site that processes it on a server side, then returns it for viewing from any browser.

https://t.me/iv?url=https%3A%2F%2Ftelegra.ph%2Fapi&rhash=3aae0ab195c808

and this link should by used by Qt WebView

like image

mugavri avatar Feb 02 '19 21:02 mugavri

@stek29 since many pages don't have iframes, why not just render the rest and in case there is an iframe replace it with a warning that the content can't be diplayed and a button to open the page in a browser?

alxlg avatar Feb 04 '19 13:02 alxlg

any updates on this? telegram desktop really needs instant view

kingwill101 avatar Feb 22 '19 15:02 kingwill101

maybe now that telegram desktop uses QT 5.12 WebEngine can be used to implement this.

Aokromes avatar Jan 27 '20 14:01 Aokromes

maybe now that telegram desktop uses QT 5.12 WebEngine can be used to implement this.

I am afraid that QtWebEngine still can't be build statically... :(

kirsan31 avatar Jan 27 '20 14:01 kirsan31

@kirsan31 could you please tell me why my suggestion is not an option? This one:

since many pages don't have iframes, why not just render the rest and in case there is an iframe replace it with a warning that the content can't be diplayed and a button to open the page in a browser?

alxlg avatar Jan 27 '20 18:01 alxlg

@alxlg The problem not only in iframes, the problem is that we have no html render control (browser) in Qt, that can be used in TD. QtWebEngine can't be build statically and other Qt controls have very limited html support...

kirsan31 avatar Jan 27 '20 18:01 kirsan31

@kirsan31 why do you need HTML support? Can't the text and the images, cached on the server as Instant View, be rendered without involving HTML? Does Telegram for Android use a web engine for Instant View? It doesn't look so...

alxlg avatar Feb 20 '20 09:02 alxlg

I'm not sure where I can examine IV documents directly, but maybe it would make sense to fetch and then convert to markdown, then render with QTextDocument or QTextBrowser. While they support some html, maybe limiting to supported element types would be simpler this way :man_shrugging:.

From New Features in Qt 5.14:

  • QTextDocument/QTextTable now support
- per-edge border styling via QTextTableCellFormat
- border-collapse mode
- HTML table style import (partial) and export
  • QTextDocument supports reading and writing Markdown format, as an alternative to HTML. If you read HTML and write Markdown, or vice-versa, the formatting should be preserved to the extent that the CommonMark and GitHub specs allow (including headings, tables, bullet lists, block quotes and code blocks); but we don't guarantee all cases yet, because it's thinly tested so far.
  • Qt Quick
- Text and TextEdit now support Markdown format (CommonMark and GitHub dialects) as an alternative to HTML.
   - Includes the GitHub checklist extension, such that you can click to toggle checkboxes in a TextEdit.

AndydeCleyre avatar Feb 20 '20 19:02 AndydeCleyre