mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
Add initial wwwroot/admin/default/ HTML5 admin pages
This commit is contained in:
parent
529d8f593c
commit
39b80e04c5
5
.gitignore
vendored
5
.gitignore
vendored
@ -3,7 +3,10 @@
|
|||||||
.project
|
.project
|
||||||
.settings/
|
.settings/
|
||||||
Makefile
|
Makefile
|
||||||
bin/
|
/src/bin/*
|
||||||
|
!/src/bin/hamcore/
|
||||||
|
/src/bin/hamcore/*
|
||||||
|
!/src/bin/hamcore/wwwroot/
|
||||||
build/
|
build/
|
||||||
cmake-build-debug/
|
cmake-build-debug/
|
||||||
src/bin/hamcore/authors.txt
|
src/bin/hamcore/authors.txt
|
||||||
|
1
src/bin/hamcore/wwwroot/admin/default/.gitignore
vendored
Normal file
1
src/bin/hamcore/wwwroot/admin/default/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
16
src/bin/hamcore/wwwroot/admin/default/.vscode/launch.json
vendored
Normal file
16
src/bin/hamcore/wwwroot/admin/default/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"trace": true,
|
||||||
|
"sourceMaps": true,
|
||||||
|
"name": "Launch Chrome",
|
||||||
|
"preLaunchTask": "webpack build",
|
||||||
|
"file": "${workspaceFolder}/index.html",
|
||||||
|
"webRoot": "${workspaceFolder}",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
5
src/bin/hamcore/wwwroot/admin/default/.vscode/settings.json
vendored
Normal file
5
src/bin/hamcore/wwwroot/admin/default/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"tsconfig_webpack.json": "jsonc"
|
||||||
|
}
|
||||||
|
}
|
45
src/bin/hamcore/wwwroot/admin/default/.vscode/tasks.json
vendored
Normal file
45
src/bin/hamcore/wwwroot/admin/default/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "webpack build",
|
||||||
|
"type": "npm",
|
||||||
|
"script": "build",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "webpack watch",
|
||||||
|
"type": "npm",
|
||||||
|
"script": "watch",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"pattern": {
|
||||||
|
"regexp": "^$"
|
||||||
|
},
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": ".*Version: webpack.*",
|
||||||
|
"endsPattern": ".*\\[built\\]"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "tsc build",
|
||||||
|
"type": "typescript",
|
||||||
|
"tsconfig": "tsconfig.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "tsc watch",
|
||||||
|
"type": "typescript",
|
||||||
|
"tsconfig": "tsconfig.json",
|
||||||
|
"option": "watch",
|
||||||
|
"problemMatcher": [
|
||||||
|
"$tsc-watch"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
23
src/bin/hamcore/wwwroot/admin/default/hub.html
Normal file
23
src/bin/hamcore/wwwroot/admin/default/hub.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<!--#include file="include_head.html" -->
|
||||||
|
<body>
|
||||||
|
<!--#include file="include_menu.html" -->
|
||||||
|
<div class="container theme-showcase" role="main">
|
||||||
|
<H2><div id="HUB_NAME"></div></H2>
|
||||||
|
|
||||||
|
<button class="btn btn-lg btn-danger" onclick="JS.DeleteVirtualHub(location.search);">Delete this Virtual Hub</button>
|
||||||
|
|
||||||
|
<H3>List of Users</H3>
|
||||||
|
<ul id="USERS_LIST"></ul>
|
||||||
|
|
||||||
|
<H3>List of Active VPN Sessions</H3>
|
||||||
|
<ul id="SESSIONS_LIST"></ul>
|
||||||
|
<!--#include file="include_footer.html" -->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
JS.HubAdminPage(location.search);
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<hr />
|
||||||
|
<p>Copyright (c) SoftEther VPN Project under the Apache License 2.0.</p>
|
9
src/bin/hamcore/wwwroot/admin/default/include_head.html
Normal file
9
src/bin/hamcore/wwwroot/admin/default/include_head.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<head>
|
||||||
|
<title>SoftEther VPN Server HTML5 Web Administration Console (Under construction!)</title>
|
||||||
|
<script src="out_webpack/bundle.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" crossorigin="anonymous">
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script>
|
||||||
|
<link href="theme.css" rel="stylesheet">
|
||||||
|
</head>
|
29
src/bin/hamcore/wwwroot/admin/default/include_menu.html
Normal file
29
src/bin/hamcore/wwwroot/admin/default/include_menu.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<!-- Fixed navbar -->
|
||||||
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||||
|
aria-expanded="false" aria-controls="navbar">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="./">SoftEther VPN Server Web Admin Console</a>
|
||||||
|
</div>
|
||||||
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="/api/">JSON-RPC API Reference</a></li>
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||||
|
aria-expanded="false">About <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="https://github.com/SoftEtherVPN/SoftEtherVPN">SoftEther VPN on GitHub</a></li>
|
||||||
|
<li><a href="https://www.softether.org/">SoftEther.org Web Site</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!--/.nav-collapse -->
|
||||||
|
</div>
|
||||||
|
</nav>
|
45
src/bin/hamcore/wwwroot/admin/default/index.html
Normal file
45
src/bin/hamcore/wwwroot/admin/default/index.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<!--#include file="include_head.html" -->
|
||||||
|
<body>
|
||||||
|
<!--#include file="include_menu.html" -->
|
||||||
|
<div class="container theme-showcase" role="main">
|
||||||
|
<H2>SoftEther VPN Server HTML5 Ajax-based Web Administration Console<BR>(Under construction!)</H2>
|
||||||
|
<p>This is the sample of HTML5 Ajax-based VPN Server Web Administration Console.</p>
|
||||||
|
<p>The purpose of this HTML5 admin page is to make administrators easy to set up and manage the running VPN Servers.</p>
|
||||||
|
<h3>Authentication for this page</h3>
|
||||||
|
<p>You must supply the HTTP basic authentication credential as following.</p>
|
||||||
|
<ul>
|
||||||
|
<li>To login to the VPN server as the entire server administrator, specify empty or "administrator" as the username field,
|
||||||
|
and specify the server administrative password as the password field.</li>
|
||||||
|
<li>To login to a particular Virtual Hub as the hub administrator, specify the hub name as the username field, and specify
|
||||||
|
the hub administrative password as the password field.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>Your HTML5 development contribution is very appreciated</h3>
|
||||||
|
<p>This HTML5 page is obviously under construction, and providing very minimum functions as sample.<BR>This initial page is written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability.<BR>Please kindly consider to contribute for <strong><a href="https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/src/bin/hamcore/wwwroot/admin/">SoftEther VPN's development on GitHub.</a></strong> Your code will help every people running SoftEther VPN Server.</p>
|
||||||
|
|
||||||
|
<p>This HTML5 page's JavaScript codes directly call <strong><a href="/api/">SoftEther VPN Server JSON-RPC API</a></strong> on the running VPN Server from the web browser.<BR>You can also call the <strong><a href="/api/">SoftEther VPN Server JSON-RPC API</a></strong> remotely from your original application. (JavaScript, TypeScript, C#, Java, Python, Ruby, etc.)</p>
|
||||||
|
<p><a href="/api/"><strong>The insanely kindness API reference</strong></a> is available.</p>
|
||||||
|
|
||||||
|
<H3>List of Virtual Hubs</H3>
|
||||||
|
<ul id="HUB_LIST"></ul>
|
||||||
|
|
||||||
|
<H3>Create new Virtual Hub</H3>
|
||||||
|
Virtual Hub Name:<BR>
|
||||||
|
<input id="NEW_HUB_NAME" /> <button class="btn btn-lg btn-primary" onclick="JS.CreateNewHub($('#NEW_HUB_NAME').val(), '#HUB_LIST')">Create</button>
|
||||||
|
|
||||||
|
<H3>VPN Server Information</H3>
|
||||||
|
<ul id="VPN_SERVER_INFO"></ul>
|
||||||
|
|
||||||
|
<H3>VPN Server Status</H3>
|
||||||
|
<ul id="VPN_SERVER_STATUS"></ul>
|
||||||
|
<!--#include file="include_footer.html" -->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
JS.ShowVpnServerInfo("#VPN_SERVER_INFO", "#VPN_SERVER_STATUS");
|
||||||
|
JS.ListVirtualHubs("#HUB_LIST");
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
|
|
2144
src/bin/hamcore/wwwroot/admin/default/out_webpack/bundle.js
Normal file
2144
src/bin/hamcore/wwwroot/admin/default/out_webpack/bundle.js
Normal file
File diff suppressed because one or more lines are too long
10
src/bin/hamcore/wwwroot/admin/default/out_webpack/ts/index.d.ts
vendored
Normal file
10
src/bin/hamcore/wwwroot/admin/default/out_webpack/ts/index.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import "core-js/es/promise";
|
||||||
|
import "core-js/es/string";
|
||||||
|
import "whatwg-fetch";
|
||||||
|
/** API test for 'Test', test RPC function */
|
||||||
|
export declare function Test_Test(): Promise<void>;
|
||||||
|
export declare function ListVirtualHubs(id: string): Promise<void>;
|
||||||
|
export declare function ShowVpnServerInfo(idInfo: string, idStatus: string): Promise<void>;
|
||||||
|
export declare function CreateNewHub(hubName: string, idList: string): Promise<void>;
|
||||||
|
export declare function HubAdminPage(queryString: string): Promise<void>;
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/index.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AAwBtB,6CAA6C;AAC7C,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAY/C;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/D;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBvF;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjF;AAED,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrE"}
|
11
src/bin/hamcore/wwwroot/admin/default/out_webpack/ts/main.d.ts
vendored
Normal file
11
src/bin/hamcore/wwwroot/admin/default/out_webpack/ts/main.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import "core-js/es/promise";
|
||||||
|
import "core-js/es/string";
|
||||||
|
import "whatwg-fetch";
|
||||||
|
/** API test for 'Test', test RPC function */
|
||||||
|
export declare function Test_Test(): Promise<void>;
|
||||||
|
export declare function ListVirtualHubs(id: string): Promise<void>;
|
||||||
|
export declare function ShowVpnServerInfo(idInfo: string, idStatus: string): Promise<void>;
|
||||||
|
export declare function CreateNewHub(hubName: string, idList: string): Promise<void>;
|
||||||
|
export declare function DeleteVirtualHub(queryString: string): Promise<void>;
|
||||||
|
export declare function HubAdminPage(queryString: string): Promise<void>;
|
||||||
|
//# sourceMappingURL=main.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/ts/main.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AAwBtB,6CAA6C;AAC7C,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAY/C;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/D;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBvF;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjF;AAcD,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBzE;AAED,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDrE"}
|
2
src/bin/hamcore/wwwroot/admin/default/out_webpack/ts/vpnadmin.d.ts
vendored
Normal file
2
src/bin/hamcore/wwwroot/admin/default/out_webpack/ts/vpnadmin.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export {};
|
||||||
|
//# sourceMappingURL=vpnadmin.d.ts.map
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"vpnadmin.d.ts","sourceRoot":"","sources":["../../src/ts/vpnadmin.ts"],"names":[],"mappings":""}
|
4709
src/bin/hamcore/wwwroot/admin/default/package-lock.json
generated
Normal file
4709
src/bin/hamcore/wwwroot/admin/default/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
27
src/bin/hamcore/wwwroot/admin/default/package.json
Normal file
27
src/bin/hamcore/wwwroot/admin/default/package.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "node_modules/.bin/webpack -d",
|
||||||
|
"watch": "node_modules/.bin/webpack -d --watch"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jquery": "^3.3.29",
|
||||||
|
"jquery": "^3.4.1",
|
||||||
|
"ts-loader": "^6.0.1",
|
||||||
|
"tslint": "^5.16.0",
|
||||||
|
"typescript": "^3.4.5",
|
||||||
|
"vpnrpc": "^1.0.1",
|
||||||
|
"webpack": "^4.32.2",
|
||||||
|
"webpack-cli": "^3.3.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": "^3.1.3",
|
||||||
|
"whatwg-fetch": "^3.0.0"
|
||||||
|
}
|
||||||
|
}
|
201
src/bin/hamcore/wwwroot/admin/default/src/ts/main.ts
Normal file
201
src/bin/hamcore/wwwroot/admin/default/src/ts/main.ts
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||||
|
// Runs on both web browsers and Node.js
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License 2.0
|
||||||
|
// Copyright (c) 2014-2018 SoftEther VPN Project
|
||||||
|
|
||||||
|
// On the web browser uncomment below imports as necessary to support old browsers.
|
||||||
|
import "core-js/es/promise";
|
||||||
|
import "core-js/es/string";
|
||||||
|
import "whatwg-fetch";
|
||||||
|
|
||||||
|
import $ = require('jquery');
|
||||||
|
|
||||||
|
// Import the vpnrpc.ts RPC stub.
|
||||||
|
import * as VPN from "vpnrpc/dist/vpnrpc";
|
||||||
|
|
||||||
|
// Output JSON-RPC request / reply strings to the debug console.
|
||||||
|
VPN.VpnServerRpc.SetDebugMode(true);
|
||||||
|
|
||||||
|
let api: VPN.VpnServerRpc;
|
||||||
|
// Creating the VpnServerRpc class instance here.
|
||||||
|
if (VPN.VpnServerRpc.IsNodeJS() === false) // // Determine if this JavaScript environment is on the Node.js or not
|
||||||
|
{
|
||||||
|
// On the web browser. We do not need to specify any hostname, port or credential as the web browser already knows it.
|
||||||
|
api = new VPN.VpnServerRpc();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// On the Node.js. We need to specify the target VPN Server's hostname, port and credential.
|
||||||
|
api = new VPN.VpnServerRpc("127.0.0.1", 443, "", "PASSWORD_HERE", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** API test for 'Test', test RPC function */
|
||||||
|
export async function Test_Test(): Promise<void>
|
||||||
|
{
|
||||||
|
console.log("Begin: Test_Test");
|
||||||
|
let a: VPN.VpnRpcTest = new VPN.VpnRpcTest(
|
||||||
|
{
|
||||||
|
IntValue_u32: 12345,
|
||||||
|
});
|
||||||
|
let b: VPN.VpnRpcTest = await api.Test(a);
|
||||||
|
console.log(b);
|
||||||
|
console.log("End: Test_Test");
|
||||||
|
console.log("-----");
|
||||||
|
console.log();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function ListVirtualHubs(id: string): Promise<void>
|
||||||
|
{
|
||||||
|
let ul: JQuery<HTMLElement> = $(id);
|
||||||
|
|
||||||
|
ul.children().remove();
|
||||||
|
|
||||||
|
let hubList = await api.EnumHub();
|
||||||
|
|
||||||
|
hubList.HubList.forEach(hub =>
|
||||||
|
{
|
||||||
|
ul.append("<li><strong><a href='./hub.html?" + hub.HubName_str + "'>" + hub.HubName_str + "</a></strong><br>" + ConcatKeysToHtml(hub) + "</li>");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function ShowVpnServerInfo(idInfo: string, idStatus: string): Promise<void>
|
||||||
|
{
|
||||||
|
let infoList = $(idInfo);
|
||||||
|
let statusList = $(idStatus);
|
||||||
|
|
||||||
|
let serverInfo = await api.GetServerInfo();
|
||||||
|
|
||||||
|
let serverStatus = await api.GetServerStatus();
|
||||||
|
|
||||||
|
Object.keys(serverInfo).forEach(key =>
|
||||||
|
{
|
||||||
|
infoList.append("<li>" + key + ": \"" + (<any>serverInfo)[key] + "\"</li>");
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.keys(serverStatus).forEach(key =>
|
||||||
|
{
|
||||||
|
statusList.append("<li>" + key + ": \"" + (<any>serverStatus)[key] + "\"</li>");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function CreateNewHub(hubName: string, idList: string): Promise<void>
|
||||||
|
{
|
||||||
|
if (hubName == null || hubName == "")
|
||||||
|
{
|
||||||
|
alert("Virtual Hub name is empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let param: VPN.VpnRpcCreateHub = new VPN.VpnRpcCreateHub(
|
||||||
|
{
|
||||||
|
HubName_str: hubName,
|
||||||
|
Online_bool: true,
|
||||||
|
HubType_u32: VPN.VpnRpcHubType.Standalone,
|
||||||
|
});
|
||||||
|
|
||||||
|
await api.CreateHub(param);
|
||||||
|
|
||||||
|
ListVirtualHubs(idList);
|
||||||
|
|
||||||
|
alert("The Virtual Hub '" + hubName + "' is created.");
|
||||||
|
}
|
||||||
|
catch (ex)
|
||||||
|
{
|
||||||
|
alert(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ConcatKeysToHtml(obj: any): string
|
||||||
|
{
|
||||||
|
let ret: string = "";
|
||||||
|
|
||||||
|
Object.keys(obj).forEach(key =>
|
||||||
|
{
|
||||||
|
ret += key + ": \"" + (<any>obj)[key] + "\"<BR>";
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function DeleteVirtualHub(queryString: string): Promise<void>
|
||||||
|
{
|
||||||
|
let hubNameInput = queryString;
|
||||||
|
if (hubNameInput.length >= 1 && hubNameInput.charAt(0) == "?") hubNameInput = hubNameInput.substring(1);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let deleteHubParam: VPN.VpnRpcDeleteHub = new VPN.VpnRpcDeleteHub(
|
||||||
|
{
|
||||||
|
HubName_str: hubNameInput,
|
||||||
|
});
|
||||||
|
|
||||||
|
await api.DeleteHub(deleteHubParam);
|
||||||
|
|
||||||
|
alert("The Virtual Hub '" + hubNameInput + "' is deleted.");
|
||||||
|
|
||||||
|
window.location.href = "./";
|
||||||
|
}
|
||||||
|
catch (ex)
|
||||||
|
{
|
||||||
|
alert(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function HubAdminPage(queryString: string): Promise<void>
|
||||||
|
{
|
||||||
|
let hubNameInput = queryString;
|
||||||
|
if (hubNameInput.length >= 1 && hubNameInput.charAt(0) == "?") hubNameInput = hubNameInput.substring(1);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let getHubParam: VPN.VpnRpcCreateHub = new VPN.VpnRpcCreateHub(
|
||||||
|
{
|
||||||
|
HubName_str: hubNameInput,
|
||||||
|
});
|
||||||
|
|
||||||
|
let hubInfo = await api.GetHub(getHubParam);
|
||||||
|
|
||||||
|
$("#HUB_NAME").append("Virtual Hub \"" + hubInfo.HubName_str + "\"");
|
||||||
|
|
||||||
|
// User list
|
||||||
|
let enumUserParam: VPN.VpnRpcEnumUser = new VPN.VpnRpcEnumUser(
|
||||||
|
{
|
||||||
|
HubName_str: hubInfo.HubName_str,
|
||||||
|
});
|
||||||
|
|
||||||
|
let enumUserRet = await api.EnumUser(enumUserParam);
|
||||||
|
|
||||||
|
let userListHtmlItem = $("#USERS_LIST");
|
||||||
|
|
||||||
|
enumUserRet.UserList.forEach(user =>
|
||||||
|
{
|
||||||
|
userListHtmlItem.append("<li><strong>" + user.Name_str + "</strong><BR>" + ConcatKeysToHtml(user) + "</li>");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sessions list
|
||||||
|
let enumSessionParam: VPN.VpnRpcEnumSession = new VPN.VpnRpcEnumSession(
|
||||||
|
{
|
||||||
|
HubName_str: hubInfo.HubName_str,
|
||||||
|
});
|
||||||
|
|
||||||
|
let enumSessionsRet = await api.EnumSession(enumSessionParam);
|
||||||
|
|
||||||
|
let sessionListHtmlItem = $("#SESSIONS_LIST");
|
||||||
|
|
||||||
|
enumSessionsRet.SessionList.forEach(session =>
|
||||||
|
{
|
||||||
|
sessionListHtmlItem.append("<li><strong>" + session.Name_str + "</strong><br>" + ConcatKeysToHtml(session) + "</li>");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (ex)
|
||||||
|
{
|
||||||
|
alert(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
18
src/bin/hamcore/wwwroot/admin/default/theme.css
Normal file
18
src/bin/hamcore/wwwroot/admin/default/theme.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
body {
|
||||||
|
padding-top: 70px;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dropdown .dropdown-menu {
|
||||||
|
position: static;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-showcase > p > .btn {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-showcase .navbar .container {
|
||||||
|
width: auto;
|
||||||
|
}
|
68
src/bin/hamcore/wwwroot/admin/default/tsconfig.json
Normal file
68
src/bin/hamcore/wwwroot/admin/default/tsconfig.json
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES3", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
||||||
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es2015.promise",
|
||||||
|
"es5"
|
||||||
|
],
|
||||||
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||||
|
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
|
"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||||
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
|
// "outDir": "./", /* Redirect output structure to the directory. */
|
||||||
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
|
// "composite": true, /* Enable project compilation */
|
||||||
|
// "removeComments": true, /* Do not emit comments to output. */
|
||||||
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
|
/* Strict Type-Checking Options */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||||
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
|
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
|
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
|
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
/* Additional Checks */
|
||||||
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
/* Module Resolution Options */
|
||||||
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
|
// "types": [], /* Type declaration files to be included in compilation. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
|
/* Source Map Options */
|
||||||
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
/* Experimental Options */
|
||||||
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
"watch": false,
|
||||||
|
"rootDir": "src/ts/",
|
||||||
|
"outDir": "out_transpiled_js/"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/ts/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
68
src/bin/hamcore/wwwroot/admin/default/tsconfig_webpack.json
Normal file
68
src/bin/hamcore/wwwroot/admin/default/tsconfig_webpack.json
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES3", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
||||||
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es2015.promise",
|
||||||
|
"es5"
|
||||||
|
],
|
||||||
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||||
|
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
|
"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||||
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
|
// "outDir": "./", /* Redirect output structure to the directory. */
|
||||||
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
|
// "composite": true, /* Enable project compilation */
|
||||||
|
// "removeComments": true, /* Do not emit comments to output. */
|
||||||
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
|
/* Strict Type-Checking Options */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||||
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
|
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
|
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
|
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
/* Additional Checks */
|
||||||
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
/* Module Resolution Options */
|
||||||
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
|
// "types": [], /* Type declaration files to be included in compilation. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
|
/* Source Map Options */
|
||||||
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
/* Experimental Options */
|
||||||
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
"watch": false,
|
||||||
|
"rootDir": "src/",
|
||||||
|
"outDir": "out_webpack/"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/ts/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
20
src/bin/hamcore/wwwroot/admin/default/tslint.json
Normal file
20
src/bin/hamcore/wwwroot/admin/default/tslint.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"defaultSeverity": "warn",
|
||||||
|
"extends": [
|
||||||
|
"tslint:recommended"
|
||||||
|
],
|
||||||
|
"jsRules": {},
|
||||||
|
"rules": {
|
||||||
|
"comment-format": false,
|
||||||
|
"no-consecutive-blank-lines": false,
|
||||||
|
"no-trailing-whitespace": false,
|
||||||
|
"no-console": false,
|
||||||
|
"prefer-const": false,
|
||||||
|
"one-line": false,
|
||||||
|
"only-arrow-functions": false,
|
||||||
|
"space-before-function-paren": false,
|
||||||
|
"trailing-comma": false,
|
||||||
|
"no-empty": false,
|
||||||
|
},
|
||||||
|
"rulesDirectory": []
|
||||||
|
}
|
38
src/bin/hamcore/wwwroot/admin/default/webpack.config.js
Normal file
38
src/bin/hamcore/wwwroot/admin/default/webpack.config.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: "development", // "production" | "development" | "none"
|
||||||
|
|
||||||
|
entry: "./src/ts/main.ts",
|
||||||
|
devtool: 'inline-source-map',
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, "out_webpack"),
|
||||||
|
filename: "bundle.js",
|
||||||
|
libraryTarget: 'var',
|
||||||
|
library: 'JS'
|
||||||
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.ts$/,
|
||||||
|
loader: "ts-loader",
|
||||||
|
options:
|
||||||
|
{
|
||||||
|
configFile: "tsconfig_webpack.json"
|
||||||
|
},
|
||||||
|
include: path.join(__dirname, "./src/ts/"),
|
||||||
|
exclude: /node_modules/
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
resolve: {
|
||||||
|
modules: [
|
||||||
|
"node_modules",
|
||||||
|
],
|
||||||
|
extensions: [
|
||||||
|
".ts",
|
||||||
|
".js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
15
src/bin/hamcore/wwwroot/admin/index.html
Normal file
15
src/bin/hamcore/wwwroot/admin/index.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="uft-8">
|
||||||
|
<script>
|
||||||
|
location.href = "/admin/default/";
|
||||||
|
</script>
|
||||||
|
<title>Redirecting</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Redirecting</h1>
|
||||||
|
<p>Redirecting...<br>
|
||||||
|
<p><a href="/admin/default/">Click here</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user