Moved the files to extension library
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,6 @@
 | 
			
		||||
[submodule "botanss"]
 | 
			
		||||
	path = botanss
 | 
			
		||||
	url = AstroGit:BotanSS.git
 | 
			
		||||
[submodule "ext/utils"]
 | 
			
		||||
	path = ext/utils
 | 
			
		||||
	url = AstroGit:botansx-utils
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								botanss
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								botanss
									
									
									
									
									
								
							 Submodule botanss updated: dcdd941f3b...cd2cce7e98
									
								
							
							
								
								
									
										1
									
								
								ext/utils
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								ext/utils
									
									
									
									
									
										Submodule
									
								
							 Submodule ext/utils added at 0ae868ac2d
									
								
							
							
								
								
									
										2
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								index.js
									
									
									
									
									
								
							@@ -56,7 +56,7 @@ else
 | 
			
		||||
 | 
			
		||||
	// Define AppNS
 | 
			
		||||
	cl.rootNS( "notifyterm", "./notify-term" );
 | 
			
		||||
	cl.rootNS( "notifysrv", "./notifysrv" );
 | 
			
		||||
	cl.rootNS( "botansx", "./ext/" );
 | 
			
		||||
 | 
			
		||||
	var App = cl.load( "notifyterm.app" );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ var cl = global.botanLoader;
 | 
			
		||||
var Dragonfly = global.Dragonfly;
 | 
			
		||||
 | 
			
		||||
var HttpRequest = cl.load( "botanss.net.HttpRequest" );
 | 
			
		||||
var ustr = cl.load( "notifysrv.utils.string" );
 | 
			
		||||
var ustr = cl.load( "botansx.utils.string" );
 | 
			
		||||
 | 
			
		||||
class Notis 
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,8 @@ var Dragonfly = global.Dragonfly;
 | 
			
		||||
var EventEmitter = require( "events" ).EventEmitter;
 | 
			
		||||
 | 
			
		||||
var HttpRequest = cl.load( "botanss.net.HttpRequest" );
 | 
			
		||||
var Rand = cl.load( "notifysrv.utils.random" );
 | 
			
		||||
var Rand = cl.load( "botansx.utils.random" );
 | 
			
		||||
 | 
			
		||||
var Notis = cl.load( "notifyterm.Notis" );
 | 
			
		||||
var Model = cl.load( "notifyterm.schema" );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ var cl = global.botanLoader;
 | 
			
		||||
var Dragonfly = global.Dragonfly;
 | 
			
		||||
 | 
			
		||||
var HttpRequest = cl.load( "botanss.net.HttpRequest" );
 | 
			
		||||
var Base = cl.load( "notifysrv.postframe" );
 | 
			
		||||
var Base = cl.load( "botanss.net.PostFrame" );
 | 
			
		||||
 | 
			
		||||
var WNSAuth = cl.load( "notifyterm.WNSAuth" );
 | 
			
		||||
var Model = cl.load( "notifyterm.schema" );
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var cl = global.botanLoader;
 | 
			
		||||
var Dragonfly = global.Dragonfly;
 | 
			
		||||
var qstr = cl.load( "notifysrv.utils.querystr" );
 | 
			
		||||
 | 
			
		||||
class EventArgs
 | 
			
		||||
{
 | 
			
		||||
	constructor()
 | 
			
		||||
	{
 | 
			
		||||
		this.Handled = false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = EventArgs;
 | 
			
		||||
@@ -1,23 +0,0 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var cl = global.botanLoader;
 | 
			
		||||
var Dragonfly = global.Dragonfly;
 | 
			
		||||
var qstr = cl.load( "notifysrv.utils.querystr" );
 | 
			
		||||
 | 
			
		||||
var EventArgs = cl.load( "notifysrv.eventargs.eventargs" );
 | 
			
		||||
 | 
			
		||||
class PostRequestEventArgs extends EventArgs
 | 
			
		||||
{
 | 
			
		||||
	constructor( QueryString )
 | 
			
		||||
	{
 | 
			
		||||
		super();
 | 
			
		||||
		this.Raw = QueryString;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	get Data()
 | 
			
		||||
	{
 | 
			
		||||
		return qstr.queryStr( this.Raw );
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = PostRequestEventArgs;
 | 
			
		||||
@@ -1,91 +0,0 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var cl = global.botanLoader;
 | 
			
		||||
var Dragonfly = global.Dragonfly;
 | 
			
		||||
 | 
			
		||||
var PostRequestEventArgs = cl.load( "notifysrv.eventargs.postrequest" );
 | 
			
		||||
var EventEmitter = require( "events" ).EventEmitter;
 | 
			
		||||
 | 
			
		||||
class PostFrame extends EventEmitter
 | 
			
		||||
{
 | 
			
		||||
	constructor( Http )
 | 
			
		||||
	{
 | 
			
		||||
		super();
 | 
			
		||||
		this.HTTP = Http;
 | 
			
		||||
		this.result = "Error: PostFrame is unhandled";
 | 
			
		||||
		this.planted = false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	run()
 | 
			
		||||
	{
 | 
			
		||||
		var _self = this;
 | 
			
		||||
		var requestStr = "";
 | 
			
		||||
 | 
			
		||||
		if( this.HTTP.request.isPost )
 | 
			
		||||
		{
 | 
			
		||||
			var Req = this.HTTP.request.raw;
 | 
			
		||||
 | 
			
		||||
			var ReceiveData = function( data )
 | 
			
		||||
			{
 | 
			
		||||
				requestStr += data + "";
 | 
			
		||||
				if( 51200 < requestStr.length )
 | 
			
		||||
				{
 | 
			
		||||
					_self.result = "The size of request is too big ( 500KB < )";
 | 
			
		||||
					Req.removeListener( "data", ReceiveData );
 | 
			
		||||
					Req.removeListener( "end", ReceiveEnd );
 | 
			
		||||
 | 
			
		||||
					_self.plantResult();
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			var ReceiveEnd = function()
 | 
			
		||||
			{
 | 
			
		||||
				var EventArgs = new PostRequestEventArgs( requestStr );
 | 
			
		||||
 | 
			
		||||
				_self.emit( "PostRequest", this, EventArgs );
 | 
			
		||||
				if( !EventArgs.Handled )
 | 
			
		||||
				{
 | 
			
		||||
					_self.result = "Error: Unhandled Request";
 | 
			
		||||
					_self.plantResult();
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			Req.addListener( "data", ReceiveData );
 | 
			
		||||
			Req.addListener( "end", ReceiveEnd );
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			Dragonfly.Info(
 | 
			
		||||
				"GET: " + encodeURI( this.HTTP.request.raw.url )
 | 
			
		||||
				+ " - " + this.HTTP.request.raw.headers["user-agent"]
 | 
			
		||||
				, Dragonfly.Visibility.VISIBLE
 | 
			
		||||
			);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		this.plantResult();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	plantResult()
 | 
			
		||||
	{
 | 
			
		||||
		if( !this.planted )
 | 
			
		||||
		{
 | 
			
		||||
			this.planted = true;
 | 
			
		||||
			if( this.HTTP )
 | 
			
		||||
			{
 | 
			
		||||
				if( !( this.result instanceof Buffer ) )
 | 
			
		||||
				{
 | 
			
		||||
					this.result = String( this.result );
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				this.HTTP.response.headers["Content-Type"] = "text/plain";
 | 
			
		||||
				this.HTTP.response.headers["Content-Length"] = this.result.length;
 | 
			
		||||
				this.HTTP.response.write( this.result );
 | 
			
		||||
				this.HTTP.response.end();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = PostFrame;
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
	queryStr: function( qstr )
 | 
			
		||||
	{
 | 
			
		||||
		var qObj = {};
 | 
			
		||||
 | 
			
		||||
		qstr.split( "&" ).forEach( function( val )
 | 
			
		||||
		{
 | 
			
		||||
			val = val.split( "=" );
 | 
			
		||||
			qObj[ val[0] ] = val[1] ? decodeURIComponent( val[1].replace( /\+/g, " " ) ) : true;
 | 
			
		||||
		} );
 | 
			
		||||
 | 
			
		||||
		return qObj;
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
var lut = []; for ( var i=0; i<256; i++ ) { lut[i] = (i<16?'0':'')+(i).toString(16); }
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
	uuid: function()
 | 
			
		||||
	{
 | 
			
		||||
		var d0 = Math.random()*0xffffffff|0;
 | 
			
		||||
		var d1 = Math.random()*0xffffffff|0;
 | 
			
		||||
		var d2 = Math.random()*0xffffffff|0;
 | 
			
		||||
		var d3 = Math.random()*0xffffffff|0;
 | 
			
		||||
		return lut[d0&0xff]+lut[d0>>8&0xff]+lut[d0>>16&0xff]+lut[d0>>24&0xff]+'-'+
 | 
			
		||||
			lut[d1&0xff]+lut[d1>>8&0xff]+'-'+lut[d1>>16&0x0f|0x40]+lut[d1>>24&0xff]+'-'+
 | 
			
		||||
			lut[d2&0x3f|0x80]+lut[d2>>8&0xff]+'-'+lut[d2>>16&0xff]+lut[d2>>24&0xff]+
 | 
			
		||||
			lut[d3&0xff]+lut[d3>>8&0xff]+lut[d3>>16&0xff]+lut[d3>>24&0xff];
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
	encodeHtml: function ( str, br )
 | 
			
		||||
	{
 | 
			
		||||
		str = ( str + "" ).replace(/&/g, "&")
 | 
			
		||||
			.replace(/</g, "<")
 | 
			
		||||
			.replace(/>/g, ">")
 | 
			
		||||
			.replace(/"/g, """)
 | 
			
		||||
			.replace(/'/g, "'")
 | 
			
		||||
		;
 | 
			
		||||
		if( br ) str = str.replace( /\n/g, "<br/>" );
 | 
			
		||||
		return str;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user