1. Andrija Cacanovic
  2. remote-script-call

Commits

Andrija Cacanovic  committed 9ea6b8b

script fix

  • Participants
  • Parent commits 60a7caf
  • Branches default

Comments (0)

Files changed (5)

File .hgignore

View file
  • Ignore whitespace
-syntax: regexp
-server/node_modules/
-WebClient/WebClient/obj/
-WebClient/WebClient/bin/
-WebClient/WebClient.suo
+# use glob syntax
+syntax: glob
+
+node_modules/
+*.csproj.user
+*.obj
+*.pdb
+*.user
+*.aps
+*.pch
+*.vspscc
+*.vssscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.tlb
+*.tlh
+*.bak
+*.cache
+*.ilk
+*.log
+*.lib
+*.sbr
+*.scc
+[Bb]in
+[Dd]ebug*/
+obj/
+[Rr]elease*/
+_ReSharper*/
+[Tt]humbs.db
+[Tt]est[Rr]esult*
+[Bb]uild[Ll]og.*
+*.[Pp]ublish.xml
+*.resharper

File WebClient/WebClient/MainForm.cs

View file
  • Ignore whitespace
 
 			this.lblStatus.Text = "Request started...";
 			RequestHandler requestHandler = new RequestHandler();
+			requestHandler.ResponseReceived += new EventHandler<ResponseReceivedEventArgs>(this.RequestHandlerResponseReceived);
 			requestHandler.StartRequest(server, method, postData);
-			requestHandler.ResponseReceived += new EventHandler<ResponseReceivedEventArgs>(this.RequestHandlerResponseReceived);
 		}
 
 		private void BtnClearConsoleClick(object sender, EventArgs e)

File WebClient/WebClient/WebClient.csproj

View file
  • Ignore whitespace
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <TargetFrameworkProfile>Client</TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <RunCodeAnalysis>false</RunCodeAnalysis>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <PlatformTarget>x86</PlatformTarget>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

File browser-client/insert_script.js

View file
  • Ignore whitespace
 	var socket,
 		clientId,
 		WS_SERVER = "http://localhost:3000/",
-		tester;
+		tester,
 	
-	function executeScript(script) {
+	executeScript = function executeScript_f(script) {
 		try {
 			return (new Function(script))();
 		} catch(err){}
 		return null;
-	}
+	},
 	
-	function sendResponse(data, requestId) {
+	sendResponse = function sendResponse_f(data, requestId) {
 		var message = {
 			data : JSON.stringify(data),
 			senderId: clientId,
 			requestId: requestId
 		};
 		
-		console.log('message response:');
+		console.log('message response');
 		socket.emit('script_response', message);
-	}
+	},
 	
-	function socketOnId(data) {
+	socketOnId = function socketOnId_f(data) {
 		clientId = data;
 		console.log('connected');
-	}
+	},
 	
-	function socketOnScriptRequest(request) {
+	socketOnScriptRequest = function socketOnScriptRequest_f(request) {
 		var result = executeScript(request.data);		
 		sendResponse(result, request.requestId);
-	}
+	},
 	
-	function connect() {		
+	connect = function connect_f() {		
 		var serverAddress = WS_SERVER;
 		if (serverAddress.match(/http:\/\//).length === 0) {
 			serverAddress = "http://" + serverAddress;
 			socket.on('id', socketOnId);
 			socket.on('script_request', socketOnScriptRequest);
 		}
-	}
+	},
 	
-	function insertScript() {
+	insertScript = function insertScript_f() {
 		var container = document.getElementsByTagName("head")[0],
-			container = container || document.getElementsByTagName("body")[0],
 			newScript = document.createElement('script');
 			
 		newScript.type = 'text/javascript';
 			}, 1000);			
 		};
 		container.appendChild(newScript);
-	}
+	};
 	
 	insertScript();
 	

File server/server.js

View file
  • Ignore whitespace
 	io = require('socket.io').listen(app),
 	uuid = require('uuid'),
 	clientList = {},
-	httpClientList = {};
+	httpClientList = {},
 
-function forIn(obj, funk) {
-	"use strict";
-	var i;
-	for (i in obj) {
-		if (obj.hasOwnProperty(i)) {
-			funk(obj[i]);
+	forIn = function forIn_f(obj, funk) {
+		"use strict";
+		var i;
+		for (i in obj) {
+			if (obj.hasOwnProperty(i)) {
+				funk(obj[i]);
+			}
 		}
-	}
-}
+	},
 
-function sendRequest(data, requestId) {
-	"use strict";
-	var msg = {
-		data : data,
-		requestId : requestId
+	sendRequest = function sendRequest_f(data, requestId) {
+		"use strict";
+		var msg = {
+			data : data,
+			requestId : requestId
+		};
+
+		forIn(clientList, function (item) {
+			item.socket.emit("script_request", msg);
+		});
+	},
+
+	sendResponse = function sendResponse_f(res) {
+		"use strict";
+		var data = res.data,
+			requestId = res.requestId,
+			client = httpClientList[requestId];
+		
+		if (client) {
+			client.res.send(data);
+			delete httpClientList[requestId];
+		}
 	};
 
-	forIn(clientList, function (item) {
-		item.socket.emit("script_request", msg);
-	});
-}
-
-function sendResponse(res) {
-	"use strict";
-	var data = res.data,
-		requestId = res.requestId,
-		client = httpClientList[requestId];
-	
-	if (client) {
-		client.res.send(data);
-		delete httpClientList[requestId];
-	}
-}
-
 app.post('/POST', function (req, res) {
 	"use strict";
 	var content = '',
 	});
 	
 	req.addListener("end", function () {
-		console.log("content recivied: " + content);
+		//console.log("content recivied: " + content);
 		//res.send('OK');
 		sendRequest(content, id);
 	});
 });
 
-app.use(express.static(__dirname)); 
-
-app.listen(3000);
-
 io.sockets.on('connection', function (socket) {
 	"use strict";
 	console.log('connected');
 	socket.emit('id', id);
 	
 	socket.on('script_response', function (response) {
+		console.dir("response: " + response);
 		sendResponse(response);
 	});
 });
+
+app.use(express.static(__dirname));
+app.listen(3000);
+