Improved downloading wikis.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-09-21 19:09:37 -05:00
parent 3d75e2729d
commit 62fb3fca65

View File

@ -312,6 +312,14 @@ TiddlyWiki >> fromDictionary: tiddlersDict [
wiki: self ])
]
{ #category : #accessing }
TiddlyWiki >> fromString: aJSONString [
| tiddlersDict |
tiddlersDict := STONJSON fromString: aJSONString.
self fromDictionary: tiddlersDict
]
{ #category : #accessing }
TiddlyWiki >> fromUrl: anUrlString [
| docTree rawJsonTiddlers tiddlersDictionary |
@ -337,10 +345,14 @@ TiddlyWiki >> importJSONFile [
that has been previosly exported by
#exportJSONFileOptimized or #exportJSONFile"
| tiddlersDict |
self tiddlersJSONFile ifNil: [ ^ self ].
tiddlersDict := STONJSON fromString: self tiddlersJSONFile contents.
self fromDictionary: tiddlersDict
self fromString: self tiddlersJSONFile contents.
]
{ #category : #accessing }
TiddlyWiki >> importJSONLink [
^ self fromString: (self remote asString, '/tiddlers.json') asUrl retrieveContents
]
{ #category : #accessing }
@ -636,7 +648,7 @@ TiddlyWiki >> taggedWith: aTag [
{ #category : #accessing }
TiddlyWiki >> tiddlers [
(self isInTiddlyHost and: [^ tiddlers isNil]) ifTrue: [ ^ self importJSONLink].
^ tiddlers ifNil: [ tiddlers := OrderedCollection new ]
]