initial commit
This commit is contained in:
parent
4a2b70b773
commit
52fce6b040
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "WebMote", "WebMote\WebMote.njsproj", "{0A0A3E54-AF0B-4B0D-A4F1-27178CC35A56}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0A0A3E54-AF0B-4B0D-A4F1-27178CC35A56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0A0A3E54-AF0B-4B0D-A4F1-27178CC35A56}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0A0A3E54-AF0B-4B0D-A4F1-27178CC35A56}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0A0A3E54-AF0B-4B0D-A4F1-27178CC35A56}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,3 @@
|
|||
# WebMote
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
|||
declare module "stylus" {
|
||||
function middleware(dir: string);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This file will modify Web.config to enable remote debugging when publishing your project in the Debug configuration.
|
||||
For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
|
||||
<system.web xdt:Transform="Insert">
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
<customErrors mode="Off"/>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
|
||||
<staticContent>
|
||||
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
|
||||
</staticContent>
|
||||
|
||||
<iisnode loggingEnabled="true"
|
||||
devErrorsEnabled="true"
|
||||
nodeProcessCommandLine="node.exe --debug"
|
||||
xdt:Transform="SetAttributes" />
|
||||
|
||||
<handlers>
|
||||
<!-- The GUID in the following path is meant to protect the debugging endpoint against inadvertent access, and should be treated as a password. -->
|
||||
<add name="NtvsDebugProxy" path="ntvs-debug-proxy/b96ba05b-4c7d-48c7-acf8-ee0137f95f49" verb="*" resourceType="Unspecified"
|
||||
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"
|
||||
xdt:Transform="Insert" />
|
||||
</handlers>
|
||||
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="NtvsDebugProxy" enabled="true" stopProcessing="true" xdt:Transform="InsertAfter(/configuration/system.webServer/rewrite/rules/clear)">
|
||||
<match url="^ntvs-debug-proxy/.*"/>
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
|
||||
</system.webServer>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
For more information on how to configure your Node.js application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=290972
|
||||
-->
|
||||
<configuration>
|
||||
<appSettings>
|
||||
|
||||
<!--
|
||||
<add key="StorageAccountName" value="" />
|
||||
<add key="StorageAccountKey" value="" />
|
||||
<add key="ServiceBusNamespace" value="" />
|
||||
<add key="ServiceBusIssuerName" value="" />
|
||||
<add key="ServiceBusIssuerSecretKey" value="" />
|
||||
-->
|
||||
</appSettings>
|
||||
<system.webServer>
|
||||
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
|
||||
<staticContent>
|
||||
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
|
||||
</staticContent>
|
||||
|
||||
<modules runAllManagedModulesForAllRequests="false" />
|
||||
|
||||
<!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
|
||||
<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.jade"/>
|
||||
|
||||
<!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. -->
|
||||
<!--<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.jade"
|
||||
loggingEnabled="true"
|
||||
devErrorsEnabled="true"
|
||||
nodeProcessCommandLine="node.exe --debug"/>-->
|
||||
|
||||
<!-- indicates that the server.js file is a Node.js application
|
||||
to be handled by the iisnode module -->
|
||||
<handlers>
|
||||
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
|
||||
|
||||
<!-- Remote debugging (Azure Website with git deploy): Uncomment NtvsDebugProxy handler below.
|
||||
Additionally copy Microsoft.NodejsTools.WebRole to 'bin' from the Remote Debug Proxy folder.-->
|
||||
<!--<add name="NtvsDebugProxy" path="ntvs-debug-proxy/b96ba05b-4c7d-48c7-acf8-ee0137f95f49" verb="*" resourceType="Unspecified"
|
||||
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/>-->
|
||||
</handlers>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<clear />
|
||||
<!-- Remote debugging (Azure Website with git deploy): Uncomment the NtvsDebugProxy rule below. -->
|
||||
<!--<rule name="NtvsDebugProxy" enabled="true" stopProcessing="true">
|
||||
<match url="^ntvs-debug-proxy/.*"/>
|
||||
</rule>-->
|
||||
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
|
||||
<match url="iisnode.+" negate="true" />
|
||||
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
|
||||
<action type="Rewrite" url="app.js" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
|
||||
<!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
|
||||
<!--<system.web>
|
||||
<httpRuntime targetFramework="4.5"/>
|
||||
<customErrors mode="Off"/>
|
||||
</system.web>-->
|
||||
</configuration>
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<Name>WebMote</Name>
|
||||
<RootNamespace>WebMote</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>0a0a3e54-af0b-4b0d-a4f1-27178cc35a56</ProjectGuid>
|
||||
<ProjectHome>.</ProjectHome>
|
||||
<StartupFile>app.ts</StartupFile>
|
||||
<SearchPath>
|
||||
</SearchPath>
|
||||
<WorkingDirectory>.</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<NodejsPort>1337</NodejsPort>
|
||||
<TypeScriptSourceMap>true</TypeScriptSourceMap>
|
||||
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
|
||||
<EnableTypeScript>true</EnableTypeScript>
|
||||
<StartWebBrowser>true</StartWebBrowser>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<TypeScriptCompile Include="app.ts" />
|
||||
<Content Include="public\javascripts\client.js" />
|
||||
<TypeScriptCompile Include="routes\index.ts" />
|
||||
<TypeScriptCompile Include="routes\user.ts" />
|
||||
<TypeScriptCompile Include="Scripts\typings\express\express.d.ts" />
|
||||
<TypeScriptCompile Include="Scripts\typings\node\node.d.ts" />
|
||||
<TypeScriptCompile Include="Scripts\typings\stylus\stylus.d.ts" />
|
||||
<Content Include="package.json" />
|
||||
<Content Include="public\stylesheets\style.styl" />
|
||||
<Content Include="README.md" />
|
||||
<Content Include="views\index.jade" />
|
||||
<Content Include="views\layout.jade" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Web.Debug.config" />
|
||||
<Content Include="bin\ChangeConfig.ps1" />
|
||||
<Content Include="bin\download.ps1" />
|
||||
<Content Include="bin\setup_web.cmd" />
|
||||
<Content Include="bin\node.cmd" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="bin\" />
|
||||
<Folder Include="public\" />
|
||||
<Folder Include="public\images\" />
|
||||
<Folder Include="public\javascripts\" />
|
||||
<Folder Include="public\stylesheets\" />
|
||||
<Folder Include="routes\" />
|
||||
<Folder Include="Scripts\" />
|
||||
<Folder Include="Scripts\typings\" />
|
||||
<Folder Include="Scripts\typings\express\" />
|
||||
<Folder Include="Scripts\typings\node\" />
|
||||
<Folder Include="Scripts\typings\stylus\" />
|
||||
<Folder Include="views\" />
|
||||
</ItemGroup>
|
||||
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
|
||||
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>0</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:48022/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>True</UseCustomServer>
|
||||
<CustomServerUrl>http://localhost:1337</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
|
||||
<WebProjectProperties>
|
||||
<StartPageUrl>
|
||||
</StartPageUrl>
|
||||
<StartAction>CurrentPage</StartAction>
|
||||
<AspNetDebugging>True</AspNetDebugging>
|
||||
<SilverlightDebugging>False</SilverlightDebugging>
|
||||
<NativeDebugging>False</NativeDebugging>
|
||||
<SQLDebugging>False</SQLDebugging>
|
||||
<ExternalProgram>
|
||||
</ExternalProgram>
|
||||
<StartExternalURL>
|
||||
</StartExternalURL>
|
||||
<StartCmdLineArguments>
|
||||
</StartCmdLineArguments>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<EnableENC>False</EnableENC>
|
||||
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -0,0 +1,65 @@
|
|||
import express = require('express');
|
||||
import routes = require('./routes/index');
|
||||
import user = require('./routes/user');
|
||||
import path = require('path');
|
||||
|
||||
var app = express();
|
||||
|
||||
var http = require('http').Server(app);
|
||||
var io = require('socket.io')(http);
|
||||
|
||||
// globals
|
||||
var remoteSocket = null;
|
||||
var remotesPayload = null;
|
||||
|
||||
// all environments
|
||||
app.set('port', process.env.PORT || 3000);
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
app.use(express.favicon());
|
||||
app.use(express.logger('dev'));
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded());
|
||||
app.use(express.methodOverride());
|
||||
app.use(app.router);
|
||||
|
||||
import stylus = require('stylus');
|
||||
app.use(stylus.middleware(path.join(__dirname, 'public')));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
// development only
|
||||
if ('development' == app.get('env')) {
|
||||
app.use(express.errorHandler());
|
||||
}
|
||||
|
||||
app.get('/', routes.index);
|
||||
app.get('/users', user.list);
|
||||
|
||||
io.on('connection', function (socket) {
|
||||
console.log('a user connected');
|
||||
|
||||
if (remotesPayload != null) {
|
||||
// if we know about some remotes, send them to the client that just connected...
|
||||
socket.emit('remotes', remotesPayload);
|
||||
}
|
||||
|
||||
socket.on('remotes', function (remotes) {
|
||||
console.log("received remotes " + remotes);
|
||||
socket.broadcast.emit('remotes', remotes); // forward to all other attached clients
|
||||
remoteSocket = socket;
|
||||
remotesPayload = remotes;
|
||||
});
|
||||
|
||||
socket.on('send_once', function (payload) {
|
||||
console.log('forwarding send_once, remote: ' + payload.remote, + ", command: ", payload.command);
|
||||
remoteSocket.emit('send_once', payload); // todo check passed in value
|
||||
});
|
||||
|
||||
socket.on('temp', function (temp) {
|
||||
socket.broadcast.emit('temp', temp);
|
||||
});
|
||||
});
|
||||
|
||||
http.listen(app.get('port'), function () {
|
||||
console.log('Express server listening on port ' + app.get('port'));
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
$configFile = $args[0]
|
||||
|
||||
Write-Host "Adding iisnode section to config file '$configFile'"
|
||||
$config = New-Object System.Xml.XmlDocument
|
||||
$config.load($configFile)
|
||||
$xpath = $config.CreateNavigator()
|
||||
$parentElement = $xpath.SelectSingleNode("//configuration/configSections/sectionGroup[@name='system.webServer']")
|
||||
$iisnodeElement = $parentElement.SelectSingleNode("//section[@name='iisnode']")
|
||||
if ($iisnodeElement) {
|
||||
Write-Host "Removing existing iisnode section from config file '$configFile'"
|
||||
$iisnodeElement.DeleteSelf()
|
||||
}
|
||||
|
||||
$parentElement.AppendChild("<section name=`"iisnode`" />")
|
||||
$config.Save($configFile)
|
|
@ -0,0 +1,87 @@
|
|||
$runtimeUrl = $args[0]
|
||||
$overrideUrl = $args[1]
|
||||
$current = [string] (Get-Location -PSProvider FileSystem)
|
||||
$client = New-Object System.Net.WebClient
|
||||
|
||||
function downloadWithRetry {
|
||||
param([string]$url, [string]$dest, [int]$retry)
|
||||
Write-Host
|
||||
Write-Host "Attempt: $retry"
|
||||
Write-Host
|
||||
trap {
|
||||
Write-Host $_.Exception.ToString()
|
||||
if ($retry -lt 5) {
|
||||
$retry=$retry+1
|
||||
Write-Host
|
||||
Write-Host "Waiting 5 seconds and retrying"
|
||||
Write-Host
|
||||
Start-Sleep -s 5
|
||||
downloadWithRetry $url $dest $retry $client
|
||||
}
|
||||
else {
|
||||
Write-Host "Download failed"
|
||||
throw "Max number of retries downloading [5] exceeded"
|
||||
}
|
||||
}
|
||||
$client.downloadfile($url, $dest)
|
||||
}
|
||||
|
||||
function download($url, $dest) {
|
||||
Write-Host "Downloading $url"
|
||||
downloadWithRetry $url $dest 1
|
||||
}
|
||||
|
||||
function copyOnVerify($file, $output) {
|
||||
Write-Host "Verifying $file"
|
||||
$verify = Get-AuthenticodeSignature $file
|
||||
Out-Host -InputObject $verify
|
||||
if ($verify.Status -ne "Valid") {
|
||||
throw "Invalid signature for runtime package $file"
|
||||
}
|
||||
else {
|
||||
mv $file $output
|
||||
}
|
||||
}
|
||||
|
||||
if ($overrideUrl) {
|
||||
Write-Host "Using override url: $overrideUrl"
|
||||
$url = $overrideUrl
|
||||
}
|
||||
else {
|
||||
$url = $runtimeUrl
|
||||
}
|
||||
|
||||
foreach($singleUrl in $url -split ";")
|
||||
{
|
||||
$suffix = Get-Random
|
||||
$downloaddir = $current + "\sandbox" + $suffix
|
||||
mkdir $downloaddir
|
||||
$dest = $downloaddir + "\sandbox.exe"
|
||||
download $singleUrl $dest
|
||||
$final = $downloaddir + "\runtime.exe"
|
||||
copyOnVerify $dest $final
|
||||
if (Test-Path -LiteralPath $final)
|
||||
{
|
||||
cd $downloaddir
|
||||
if ($host.Version.Major -eq 3)
|
||||
{
|
||||
.\runtime.exe -y | Out-Null
|
||||
.\setup.cmd
|
||||
}
|
||||
else
|
||||
{
|
||||
Start-Process -FilePath $final -ArgumentList -y -Wait
|
||||
$cmd = $downloaddir + "\setup.cmd"
|
||||
Start-Process -FilePath $cmd -Wait
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Unable to verify package"
|
||||
}
|
||||
cd $current
|
||||
if (Test-Path -LiteralPath $downloaddir)
|
||||
{
|
||||
Remove-Item -LiteralPath $downloaddir -Force -Recurse
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
node.exe %1 %2 %3
|
|
@ -0,0 +1,57 @@
|
|||
@echo on
|
||||
|
||||
cd /d "%~dp0"
|
||||
|
||||
if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup
|
||||
if "%EMULATED%"== "true" exit /b 0
|
||||
|
||||
echo Granting permissions for Network Service to the web root directory...
|
||||
icacls ..\ /grant "Network Service":(OI)(CI)W
|
||||
if %ERRORLEVEL% neq 0 goto error
|
||||
echo OK
|
||||
|
||||
echo Configuring powershell permissions
|
||||
powershell -c "set-executionpolicy unrestricted"
|
||||
|
||||
echo Downloading and installing runtime components
|
||||
powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%'
|
||||
if %ERRORLEVEL% neq 0 goto error
|
||||
|
||||
echo SUCCESS
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo FAILED
|
||||
exit /b -1
|
||||
|
||||
:emulator_setup
|
||||
echo Running in emulator adding iisnode to application host config
|
||||
FOR /F "tokens=1,2 delims=/" %%a in ("%APPCMD%") DO set FN=%%a&set OPN=%%b
|
||||
if "%OPN%"=="%OPN:apphostconfig:=%" (
|
||||
echo "Could not parse appcmd '%appcmd% for configuration file, exiting"
|
||||
goto error
|
||||
)
|
||||
|
||||
set IISNODE_BINARY_DIRECTORY=%programfiles(x86)%\iisnode-dev\release\x64
|
||||
set IISNODE_SCHEMA=%programfiles(x86)%\iisnode-dev\release\x64\iisnode_schema.xml
|
||||
|
||||
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto start
|
||||
set IISNODE_BINARY_DIRECTORY=%programfiles%\iisnode-dev\release\x86
|
||||
set IISNODE_SCHEMA=%programfiles%\iisnode-dev\release\x86\iisnode_schema_x86.xml
|
||||
|
||||
|
||||
:start
|
||||
set
|
||||
|
||||
echo Using iisnode binaries location '%IISNODE_BINARY_DIRECTORY%'
|
||||
echo installing iisnode module using AppCMD alias %appcmd%
|
||||
%appcmd% install module /name:"iisnode" /image:"%IISNODE_BINARY_DIRECTORY%\iisnode.dll"
|
||||
|
||||
set apphostconfigfile=%OPN:apphostconfig:=%
|
||||
powershell -c "set-executionpolicy unrestricted"
|
||||
powershell .\ChangeConfig.ps1 %apphostconfigfile%
|
||||
if %ERRORLEVEL% neq 0 goto error
|
||||
|
||||
copy /y "%IISNODE_SCHEMA%" "%programfiles%\IIS Express\config\schema\iisnode_schema.xml"
|
||||
if %ERRORLEVEL% neq 0 goto error
|
||||
exit /b 0
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "WebMote",
|
||||
"version": "0.0.0",
|
||||
"description": "WebMote",
|
||||
"main": "app.js",
|
||||
"author": {
|
||||
"name": "Mike",
|
||||
"email": ""
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "3.4.4",
|
||||
"jade": "*",
|
||||
"socket.io": "^1.3.6",
|
||||
"stylus": "*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
var socket = io();
|
||||
|
||||
var viewModel = {
|
||||
message: ko.observable("hello"),
|
||||
remotes: ko.observable(),
|
||||
temp_c: ko.observable(),
|
||||
temp_f: ko.observable(),
|
||||
send: function (remote, command) {
|
||||
socket.emit('send_once', { remote: remote, command: command });
|
||||
}
|
||||
}
|
||||
|
||||
socket.on('connect', function () {
|
||||
viewModel.message("connected");
|
||||
|
||||
socket.on('remotes', function (remotesPayload) {
|
||||
viewModel.remotes(remotesPayload.remotes);
|
||||
});
|
||||
|
||||
socket.on('temp', function (temp) {
|
||||
var temp_c = temp * 1.0 / 1000;
|
||||
viewModel.temp_c(temp_c);
|
||||
viewModel.temp_f(temp_c * 9.0 / 5.0 + 32.0);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
body
|
||||
padding: 50px
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif
|
||||
a
|
||||
color: #00B7FF
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* GET home page.
|
||||
*/
|
||||
import express = require('express');
|
||||
|
||||
export function index(req: express.Request, res: express.Response) {
|
||||
res.render('index', { title: 'Express' });
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* GET users listing.
|
||||
*/
|
||||
import express = require('express');
|
||||
|
||||
export function list(req: express.Request, res: express.Response) {
|
||||
res.send("respond with a resource");
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
meta(http-equiv="X-UA-Compatible", content="IE=edge")
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1")
|
||||
title= title
|
||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
|
||||
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css')
|
||||
script(src="/socket.io/socket.io.js")
|
||||
script(type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.js")
|
||||
script(type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.1.0.js")
|
||||
script(type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js")
|
||||
script(src="/javascripts/client.js")
|
||||
body
|
||||
block content
|
||||
script(type="text/javascript").
|
||||
ko.applyBindings(viewModel);
|
Loading…
Reference in New Issue