Can we allow iframes to tiddlytalk content and is there problems doing it?

Hi, I just tried to use an iframe to talk.tiddlywiki.org or its content and it is refused like most sites.

Can we allow iframes to tiddlytalk content and is there problems doing it?

It would be nice to have a live reference to talk.tiddlywiki.org because it can make a static tiddlywiki become an interactive one!

It would also allow one to maintain links to live conversations in a tiddlywiki to organise ones work on tiddlywiki, then you need not have to depend on bookmarks or search.

Personally I don’t see much room for misuse as all it does is empower access to out resources, the way tiddlywiki works nothing will touch the server unless the specific tiddler is opened. This allows a whole new world of metadata to be maintained in a wiki as an overlay to content in discourse. For example we could curate “how to” or “plugin” posts in a Wiki.

Sure this is already possible with links but its less interactive and removes you from our “heartland” tiddlywiki.

Alternatively a plugin / api would be nice.

I have found this;

Thanks for doing the research! I checked the box to enable this:

2 Likes

Thanks, I can see http://talk.tiddlywiki.org/javascripts/embed-topics.js online.

I am still working on this;

I have a tiddler tagged $:/tags/RawMarkup containing
<script src="http://talk.tiddlywiki.org/javascripts/embed-topics.js"></script>

I have another tiddler where I hope to embed it;

<d-topics-list discourse-url="https://talk.tiddlywiki.org" per-page="6"></d-topics-list>
<iframe src="https://talk.tiddlywiki.org" frameborder="0" scrolling="no" height="175px"></iframe>

The above is not working and I expect wrong. I will continue.

No iframe required from reading the link you tagged – the script tag grabs the content remotely.

The javascript needs to be loaded globally in TW and then where you have that <d-topics-list> the script will replace that with a list of topics.

The example site is simple to view source on: https://embed.eviltrout.com/

This is a typical code pattern that assumes a static HTML file.

Unfortunately, this does not work in TiddlyWiki… The problem is that, even though the javascript is “loaded globally” using $:/tags/RawMarkup, no tiddlers are rendered at that time, so the element <d-topics-list> does not yet exist.

I tried putting the <d-topics-list> element in the same $:/tags/RawMarkup tiddler:

<script src="http://talk.tiddlywiki.org/javascripts/embed-topics.js"></script>
<d-topics-list discourse-url="https://talk.tiddlywiki.org" per-page="6"></d-topics-list>

But that didn’t work. It did show an iframe at the bottom of the page (I think it was generated by the script), but that displayed an error: “talk.tiddlywiki.org refused to connect”, which is a common error message when attempting cross-origin scripting from file://

I also tried using a variation of @Charlie_Veniot’s iframe scripting method by putting the following into a regular tiddler:

\define source()
<head>
   <script src="http://talk.tiddlywiki.org/javascripts/embed-topics.js"></script>
</head>
<body>
   <d-topics-list discourse-url="https://talk.tiddlywiki.org" per-page="6">test</d-topics-list>
</body>
\end
<iframe srcdoc=<<source>> style="width:100%;height:50vh;"></iframe>

But that also didn’t work :frowning:, and didn’t even give any error message, although it did render an iframe.

-e

Sorry, yes, assume zero knowledge of TW parsing flow on my part, I was just pointing out that this code isn’t to be used in tandem with an iframe – it generates iframes as part of script output.

Thanks for trying and clarifying!

tbh (i loathe “discourse” forum )
would i would like to see
/daydreams
is if i could “export-discourse” topic into a “topic-tiddler”
with similar ui (like talk.tiddlywiki post & left:post/date slider )

I love discourse or talk.tiddlywiki If your new to it have a little patience, it works well for our community…

my issue is was mainly
when viewing without js enabled
was less easy to scrape :wink:

… but it seams that might have been
a an older version / long time ago
or some-other svr/instance config option …

because i just tested talk.tw with script-disabled again
pagination appears “?page=2” less obtuse than i recall

though im not such a fan of ‘?u=wiki_user’ (being appened to links could it be user configurable , ie disabled by me !? ;- )

… so i guess
wrt : Can we allow iframes to tiddlytalk content and is there problems doing it? - #8 by wiki_user

that might be possible with " tm-http-request"
though i didnt have much luck
… it appears ( from reading CORS for webserver API to GET tiddler ) cors was the issue and
https://api.allorigins.win/raw?url=
might help …


\procedure store-fetched-output()
<$action-setfield $tiddler=Output status=<<status>> error=<<error>> data=<<data>> headers=<<headers>>/>
\end

\procedure http-get()
	<$action-sendmessage
		$message="tm-http-request"
		url="https://api.allorigins.win/raw?url=https://talk.tiddlywiki.org/t/other-fun-with-iframes/249"
		method="GET"
		oncompletion=<<store-fetched-output>>
	/>
\end

<$button actions=<<http-get>>>send HTTP GET</$button>

well that works … so it appears possible to scrape with tw =]

… i guess i need some xml
(shudders …thinking of “the json saga”) tools / parser
to get a the txt from markup-data

1 Like

“might help”

It does. Very much.
By illustrating how with a scrape we might get round some obstacles to better integrate talk.tiddlywiki.org with end-use TW’s.

If you haven’t seen it, I kind of obsessed on http fetches in Has anyone used the Random Dog Method?.

Suitably solved by @telumire in Has anyone used the Random Dog Method? - #24 by telumire for sampling TiddlyHost wikis.


TBH, I think you are in the right direction!

I got your tool working to fetch specific posts from Discourse.

There are many issues but, basically, the approach works.

Tx, TT


p.s. -- A Random Dog

Do you mean you’re able — from within a TW instance — to display specific posts from discourse?

If so, could you post a link to a working demo of this?

(Having spent some time trying to go down this rabbit-hole, without success, I’m reluctant to try to reconstruct anything based on a “that’s helpful” confirmation.)

{{Output!!data}} from the store-fetched-output() example above will display the thread.

talk.tiddlywiki - thread 841.json (595 Bytes)

1 Like

Yes. But you are not looking at it “out-there”. It is become part of your TW via http: fetching. A post becomes a Tiddler.

Understood. I see that @john.edw_gmail.com did already.

I tried a “Fetch” for Talk TW - Community discussion forum about TiddlyWiki = https://talk.tiddlywiki.org/latest … and in my wiki I see …

Obviously it is both potentially v. useful and a big mess.
Of course, in the fetch, the CSS gets left behind and images of users break.

There may be ways round these issues?
I don’t know.
Experts in http fetches or site scraping probably would?

TT

(afaik unless some discourse api exists??)
this would require
some

this

+(dependency’s ! …
GitHub - fb55/htmlparser2: The fast & forgiving HTML and XML parser
though perhaps

:soupselect.js
var domUtils = require(“htmlparser”).DomUtils;

only
GitHub - fb55/domutils: Utilities for working with htmlparser2's DOM is actually required )

it appears the tw.talk hypertext-markup
for posts has/can be selected via the following attributes

class=‘post’ itemprop=‘articleBody’ <

i didnt find any mention of htmlparser on tw.talk

so idk if any “plugin” all ready exists

… to extract posts
what is required (imho) is to create plugin(s) for domutils and soupselect.js

and some how pass the “page-html” to soupselect and “filter” the class='post' div’s an select the ones to do something
with

id guess it would be ‘nice’ to have tiddler titles
like [topic-title]/[topic-id]/[post-number]
mirror discourse topic url format

1 Like
1 Like