This commit is contained in:
Nick Bebout 2022-02-15 12:29:45 -06:00
parent f98c9946e5
commit 2f815205a9
72 changed files with 4567 additions and 1469 deletions

View file

@ -1,57 +1,77 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>Imapsync CSV online</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="../S/style.css" type="text/css" />
<link rel="license" href="https://imapsync.lamiral.info/NOLIMIT">
<!-- -->
</head>
<body>
<h1>Imapsync online</h1>
<h1>Imapsync CSV online</h1>
<p>
This file is a sandbox to play with, to learn, understand what happens, what can be done etc.<br/>
<a href="#BOTTOM">Bottom of this page</a>
This Imapsync CSV online service is a prototype, a working prototype.<br/>
</p>
Some explanations about this service:
<ul>
<li>The input textarea is multi-lines, each line describe a synchronization from the source account to the destination account.</li>
<li>Blank lines are ignored. Blanks lines have only spaces or tabs or nothing but a CR</li>
<li>Lines beginning with # are also ignored, use that for commenting.</li>
<li>A basic line will sync all messages in all folders from the source account to the destination account.</li>
<li>Each line has seven columns, six for the credentials, and one extra to add one or several parameters to the imapsync command.</li>
<li>Each line has seven semi-colons characters ";", each one delimiting a column. The last column can be empty.</li>
<li>Each line is processed serially, one synchronization at a time.</li>
<li>At the end of the log, the lines that failed are listed.</li>
<li>The input textarea is prefilled with values, as an example, replace them with yours or remove them.</li>
<li></li>
<li></li>
<li></li>
</ul>
<form id="form" action="/cgi-bin/imapsync_csv_wrapper" method="post" autocomplete="on">
<textarea name="csv_data" rows="10" cols="120">
# This example is a real one, ie, truly working in the real world.
test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;secret2;
<textarea id="csv_data" name="csv_data" rows="10" cols="120">
# This example is a real one, ie, a truly working in the real world.
test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;secret2;;
# The reverse
test2.lamiral.info;test2;secret2;test1.lamiral.info;test1;secret1;
# The first again but this time with an authentication failure
test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;wrong_secret;;
# The first again but with authentication failure
test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;wrong;
# The first again but this time with extra parameters
test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;secret2;--justfoldersizes --dry --minage 55 ;
</textarea>
<br/>
</form>
<button type="button"
onclick="imapsync( handleRun )"
>Run imapsync on all csv data
<p>
<button id="bt-sync" type="button">
Run imapsync on all csv data!
</button>
<button type="button"
onclick="abort( )"
>Abort imapsync
<button id="bt-abort" type="button">
Abort the run!
</button>
</p>
<p>
<a href="#BOTTOM">Link to the bottom of this page (end of the log)</a>
</p>
<h2>Console of imapsync runs</h2>
@ -63,13 +83,11 @@ test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;wrong;
<pre id="abort">
</pre>
<h2>Log of imapsync runs</h2>
<h2>Log of all imapsync runs</h2>
<pre id="output" >
</pre>
<h2>Links</h2>
<div id="BOTTOM">
@ -78,89 +96,11 @@ test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;wrong;
</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
var readyStateStr = {
0: "Request not initialized",
1: "Server connection established",
2: "Response headers received",
3: "Processing request",
4: "Finished and response is ready"
} ;
function imapsync( cFunction ) {
var xhr ;
xhr = new XMLHttpRequest( ) ;
var timerRefreshLog = setInterval( function() { refreshLog( xhr ) }, 3000 ) ;
xhr.onreadystatechange = function( ) {
cFunction( this, timerRefreshLog ) ;
} ;
var form_querystring = $("#form").serialize() ;
$("#form_querystring").text( form_querystring ) ;
xhr.open( "POST", "/cgi-bin/imapsync_csv_wrapper", true ) ;
xhr.setRequestHeader( "Content-type",
"application/x-www-form-urlencoded" ) ;
xhr.send( form_querystring ) ;
$("#output").text("Here comes the log!\n\n") ;
xhr.send( ) ;
}
function handleRun( xhr, timerRefreshLog ) {
$( "#console" ).text( "Status: " + xhr.status + " " + xhr.statusText + ".\n"
+ "State: " + readyStateStr[ xhr.readyState ] + "\n" ) ;
if ( xhr.status == 200 && xhr.readyState == 4 ) {
var headers = xhr.getAllResponseHeaders( ) ;
clearInterval( timerRefreshLog ) ;
refreshLog( xhr ) ; // a last time
}
}
function refreshLog( xhr ) {
$( "#output" ).text( xhr.responseText ) ;
}
function abort()
{
var querystring = $("#form").serialize() + "&abort=on";
var xhr;
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function ()
{
handleAbort(xhr);
};
xhr.open("POST", "/cgi-bin/imapsync_csv_wrapper", true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(querystring);
}
function handleAbort( xhr ) {
$( "#abort" ).text( "Status: " + xhr.status + " " + xhr.statusText + ".\n"
+ "State: " + readyStateStr[ xhr.readyState ] + "\n" ) ;
if ( xhr.status == 200 && xhr.readyState == 4 ) {
var headers = xhr.getAllResponseHeaders( ) ;
// $( "#abort" ).append( "\n" + headers + "\n" ) ;
$( "#abort" ).append( xhr.responseText ) ;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<script src="sandbox_csv.js">
</script>
</body>
</html>