Improving download for wikis with embedded media.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-07-28 13:28:53 -05:00
parent d72f4df6fe
commit eedff7e4cc

View File

@ -229,7 +229,16 @@ TiddlyWiki >> downloadHTML [
]
{ #category : #accessing }
TiddlyWiki >> downloadJSONCache [
TiddlyWiki >> downloadLink: v into: subfolder [
| filePath fileName semiFilePath |
fileName := v asUrl segments last.
semiFilePath := subfolder , fileName.
filePath := (FileLocator temp / semiFilePath) fullName.
GtSubprocessWithInMemoryOutput new
shellCommand: 'curl -L -# ' , v , ' -o ' , filePath;
runAndWait;
stdout.
^ FileLocator temp / semiFilePath
]
{ #category : #accessing }
@ -557,6 +566,11 @@ TiddlyWiki >> isInTiddlyHost [
^ self remote host endsWith: 'tiddlyhost.com'
]
{ #category : #accessing }
TiddlyWiki >> jsonCache [
self downloadLink: self tiddlersJSONUrl into: self folder.
]
{ #category : #accessing }
TiddlyWiki >> jsonFile [
^ jsonFile ifNil: [
@ -859,7 +873,7 @@ TiddlyWiki >> remoteTiddlersContentsString [
self isInTiddlyHost ifFalse: [ ^ self ].
jsonAddress := self remote asString, '/tiddlers.json'.
^ [jsonAddress asZnUrl retrieveContents]
onErrorDo: [ self downloadJSONCache ].
onErrorDo: [ self jsonCache ].
]
{ #category : #accessing }