-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of pieserver.local:TiddlyPlugins/Bob
- Loading branch information
Showing
31 changed files
with
1,051 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/*\ | ||
title: $:/plugins/OokTech/Bob/action-opensocket.js | ||
type: application/javascript | ||
module-type: widget | ||
Action widget that creates a new websocket connection to another server | ||
<$action-opensocket $url=<<someURL>> blah=halb/> | ||
\*/ | ||
(function(){ | ||
|
||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; | ||
|
||
const Widget = require("$:/core/modules/widgets/widget.js").widget; | ||
|
||
const ActionOpenSocket = function(parseTreeNode,options) { | ||
this.initialise(parseTreeNode,options); | ||
}; | ||
|
||
/* | ||
Inherit from the base widget class | ||
*/ | ||
ActionOpenSocket.prototype = new Widget(); | ||
|
||
/* | ||
Render this widget into the DOM | ||
*/ | ||
ActionOpenSocket.prototype.render = function(parent,nextSibling) { | ||
this.computeAttributes(); | ||
this.execute(); | ||
}; | ||
|
||
/* | ||
Compute the internal state of the widget | ||
*/ | ||
ActionOpenSocket.prototype.execute = function() { | ||
this.remoteURL = this.getAttribute('$url', ''); | ||
}; | ||
|
||
/* | ||
Refresh the widget by ensuring our attributes are up to date | ||
*/ | ||
ActionOpenSocket.prototype.refresh = function(changedTiddlers) { | ||
const changedAttributes = this.computeAttributes(); | ||
if(Object.keys(changedAttributes).length) { | ||
this.refreshSelf(); | ||
return true; | ||
} | ||
return this.refreshChildren(changedTiddlers); | ||
}; | ||
|
||
/* | ||
Invoke the action associated with this widget | ||
*/ | ||
ActionOpenSocket.prototype.invokeAction = function(triggeringWidget,event) { | ||
$tw.RemoteConnection = $tw.RemoteConnection || {}; | ||
if (this.remoteURL) { | ||
$tw.RemoteConnection.socket = new WebSocket(this.remoteURL); | ||
$tw.RemoteConnection.socket.onopen = openSocket; | ||
$tw.RemoteConnection.socket.onmessage = parseMessage; | ||
$tw.RemoteConnection.socket.binaryType = "arraybuffer"; | ||
} | ||
return true; // Action was invoked | ||
}; | ||
|
||
function openSocket(event) { | ||
console.log(event.target) | ||
event.target.send('HI!') | ||
} | ||
|
||
function parseMessage() { | ||
|
||
} | ||
|
||
exports["action-opensocket"] = ActionOpenSocket; | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
title: $:/plugins/OokTech/Bob/FederationTab | ||
caption: Federation | ||
|
||
Coming soon | ||
|
||
<!-- | ||
Federation stuff!! | ||
|
||
We need to add ways to sync with other wikis, a way to configure what gets | ||
synced, stuff like that. | ||
|
||
!!Active Connections | ||
|
||
<$list | ||
filter='[list[$:/Bob/ActiveConnections]]' | ||
> | ||
|
||
</$list> | ||
|
||
!!Known Connections | ||
|
||
url, name, synced wikis, other actions | ||
|
||
something for security, pubilc keys probably | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
title: $:/config/SaverFilter | ||
|
||
[is[system]!is[system]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
title: title: $:/plugins/OokTech/Bob/InterServerFederation | ||
caption: Inter-server Federation | ||
|
||
Coming soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Documentation/WebSocketMessages/WebSocketMessage-mediaScan.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
title: $:/plugins/OokTech/Bob/WebSocketMessage-mediaScan | ||
tags: [[Websocket Message]] | ||
caption: mediaScan | ||
description: Scan a folder for media and create _canonical_uri tiddlers for each file found | ||
|
||
This message is used to scan a folder for media files and create a | ||
_canonical_uri tiddler for each file found. | ||
|
||
''NOTE:'' Only folders that are children of the folder set as the | ||
`filePathRoot` in the settings can be scanned. | ||
|
||
!!Usage | ||
|
||
|!Name |!Description | | ||
|!folder |The folder to scan, either absolute or relative to the file path root. (No Default) | | ||
|!ignoreExisting |If this is set to `yes` any tiddler with _canonical_uri that matches a file exists nothing further is done with that file (this takes precidence over overwrite) (Default `no`) | | ||
|!overwrite |If this is set to `yes` than new tiddlers are made even if they overwrite existing tiddlers. (Default `no`) | | ||
|!prune |If this is set to `yes` than any tiddlers that have _canonical_uri fields that point to a file that would be in the folder being scanned that doesn't exist the tiddler is removed. (Default `no`) | | ||
|!mediaTypes |(Optional) A space separated list of file extensions to scan for. If no list is given all types listed in the mimeMap will be used. | | ||
|
||
``` | ||
<$action-websocketmessage $type='mediaScan' folder='wikiFolderPath' ignoreExisting='editionName' overwrite='newWikiName' prune='basePath' mediaTypes='.jpg .png .jpeg'/> | ||
``` | ||
|
||
The default mimeMap is: | ||
|
||
``` | ||
{ | ||
'.aac': 'audio/aac', | ||
'.avi': 'video/x-msvideo', | ||
'.csv': 'text/csv', | ||
'.doc': 'application/msword', | ||
'.epub': 'application/epub+zip', | ||
'.gif': 'image/gif', | ||
'.html': 'text/html', | ||
'.htm': 'text/html', | ||
'.ico': 'image/x-icon', | ||
'.jpg': 'image/jpeg', | ||
'.jpeg': 'image/jpeg', | ||
'.mp3': 'audio/mpeg', | ||
'.mpeg': 'video/mpeg', | ||
'.oga': 'audio/ogg', | ||
'.ogv': 'video/ogg', | ||
'.ogx': 'application/ogg', | ||
'.png': 'image/png', | ||
'.svg': 'image/svg+xml', | ||
'.weba': 'audio/weba', | ||
'.webm': 'video/webm', | ||
'.wav': 'audio/wav' | ||
} | ||
``` |
8 changes: 8 additions & 0 deletions
8
Documentation/WebSocketMessages/WebSocketMessage-openRemoteConnection.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title: $:/plugins/OokTech/Bob/WebSocketMessage-openRemoteConnection | ||
tags: [[Websocket Message]] | ||
caption: openRemoteConnection | ||
description: A message that tells the server to open a connection to a remote server. | ||
|
||
This message tells the server to try and open a connection to a remote server. | ||
|
||
This is the first step to having federated communication between wikis. |
11 changes: 0 additions & 11 deletions
11
Documentation/WebSocketMessages/WebSocketMessage-restartServer.tid
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.