1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-09-10 06:46:06 +00:00

Experimental plugin for Tahoe-LAFS

This commit is contained in:
Jeremy Ruston
2013-04-26 22:18:46 +01:00
parent add35e9523
commit 8e582e002b
9 changed files with 142 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
{
"title": "$:/plugins/tiddlywiki/tahoelafs",
"description": "Support for saving changes to Tahoe-LAFS",
"author": "JeremyRuston",
"version": "0.0.0",
"coreVersion": ">=5.0.0"
}

View File

@@ -0,0 +1,57 @@
/*\
title: $:/plugins/tiddlywiki/tahoelafs/saver.js
type: application/javascript
module-type: saver
A bare bones saver for Tahoe-LAFS. It just PUTs the new HTML file back to the server at the same URL.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Select the appropriate saver module and set it up
*/
var TahoeSaver = function(wiki) {
this.wiki = wiki;
};
TahoeSaver.prototype.save = function(text) {
// Do the HTTP post
var http = new XMLHttpRequest();
http.open("PUT",document.location.toString(),true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
window.alert("Saved to Tahoe-LAFS: " + http.responseText);
}
};
http.send(text);
return true;
};
/*
Information about this saver
*/
TahoeSaver.prototype.info = {
name: "tahoelafs",
priority: 1000
};
/*
Static method that returns true if this saver is capable of working
*/
exports.canSave = function(wiki) {
return true;
};
/*
Create an instance of this saver
*/
exports.create = function(wiki) {
return new TahoeSaver(wiki);
};
})();