DEHUMANIZE YOURSELF AND FACE TO BLOODSHED DEHUMANIZE YOURSELF AND FACE TO BLOODSHED DEHUMANIZE YOURSELF AND FACE TO BLOODSHED DEHUMANIZE YOURSELF AND FACE TO BLOODSHED DEHUMANIZE YOURSELF AND FACE TO BLOODSHED DEHUMANIZE YOURSELF AND FACE TO BLOODSHED DEHUMANIZE YOURSELF AND FACE TO BLOODSHED
This commit is contained in:
parent
c9c09c79ef
commit
47134fece3
12 changed files with 76 additions and 57 deletions
0
client/build.sh
Normal file
0
client/build.sh
Normal file
|
@ -1,7 +0,0 @@
|
||||||
mkdir \\aroltd.com\aroltd\scape
|
|
||||||
mkdir \\aroltd.com\aroltd\scape\bin
|
|
||||||
copy /y /b index.html \\aroltd.com\aroltd\scape
|
|
||||||
copy /y /b error.html \\aroltd.com\aroltd\scape
|
|
||||||
copy /y /b style.css \\aroltd.com\aroltd\scape
|
|
||||||
copy /y /b bin\scape.js \\aroltd.com\aroltd\scape\bin
|
|
||||||
copy /y /b bin\lib.js \\aroltd.com\aroltd\scape\bin
|
|
|
@ -59,7 +59,7 @@
|
||||||
<h1 class="loading-header">LOADING</h1>
|
<h1 class="loading-header">LOADING</h1>
|
||||||
<div id="loading-page-bar">
|
<div id="loading-page-bar">
|
||||||
<h2 id="loading-page-bar-percent" class="loading-page-bar-percent">1%</h2>
|
<h2 id="loading-page-bar-percent" class="loading-page-bar-percent">1%</h2>
|
||||||
<div id="loading-page-bar-progress"></h1>
|
<div id="loading-page-bar-progress"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var SockContext = (function () {
|
var SockContext = /** @class */ (function () {
|
||||||
function SockContext() {
|
function SockContext() {
|
||||||
}
|
}
|
||||||
Object.defineProperty(SockContext, "masterSock", {
|
Object.defineProperty(SockContext, "masterSock", {
|
||||||
|
@ -19,10 +19,10 @@ var SockContext = (function () {
|
||||||
if (this.didInit)
|
if (this.didInit)
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
SockContext.didInit = false;
|
||||||
return SockContext;
|
return SockContext;
|
||||||
}());
|
}());
|
||||||
SockContext.didInit = false;
|
var Entrypoint = /** @class */ (function () {
|
||||||
var Entrypoint = (function () {
|
|
||||||
function Entrypoint() {
|
function Entrypoint() {
|
||||||
}
|
}
|
||||||
Entrypoint.initCheck = function () {
|
Entrypoint.initCheck = function () {
|
||||||
|
@ -54,13 +54,13 @@ var Entrypoint = (function () {
|
||||||
Entrypoint.ready = function () {
|
Entrypoint.ready = function () {
|
||||||
//alert("ready");
|
//alert("ready");
|
||||||
};
|
};
|
||||||
return Entrypoint;
|
Entrypoint.initStatus = {
|
||||||
}());
|
|
||||||
Entrypoint.initStatus = {
|
|
||||||
keyInit: false,
|
keyInit: false,
|
||||||
fileCache: false
|
fileCache: false
|
||||||
};
|
};
|
||||||
var FileCache = (function () {
|
return Entrypoint;
|
||||||
|
}());
|
||||||
|
var FileCache = /** @class */ (function () {
|
||||||
function FileCache() {
|
function FileCache() {
|
||||||
}
|
}
|
||||||
FileCache.initCache = function (success, error) {
|
FileCache.initCache = function (success, error) {
|
||||||
|
@ -125,15 +125,15 @@ var FileCache = (function () {
|
||||||
store = query.objectStore("metadata");
|
store = query.objectStore("metadata");
|
||||||
store.delete(fileName);
|
store.delete(fileName);
|
||||||
};
|
};
|
||||||
|
FileCache.dbHandle = null;
|
||||||
return FileCache;
|
return FileCache;
|
||||||
}());
|
}());
|
||||||
FileCache.dbHandle = null;
|
var FileMeta = /** @class */ (function () {
|
||||||
var FileMeta = (function () {
|
|
||||||
function FileMeta() {
|
function FileMeta() {
|
||||||
}
|
}
|
||||||
return FileMeta;
|
return FileMeta;
|
||||||
}());
|
}());
|
||||||
var MasterProtocol = (function () {
|
var MasterProtocol = /** @class */ (function () {
|
||||||
function MasterProtocol() {
|
function MasterProtocol() {
|
||||||
}
|
}
|
||||||
Object.defineProperty(MasterProtocol, "packetHandlers", {
|
Object.defineProperty(MasterProtocol, "packetHandlers", {
|
||||||
|
@ -158,7 +158,7 @@ var MasterProtocol = (function () {
|
||||||
};
|
};
|
||||||
return MasterProtocol;
|
return MasterProtocol;
|
||||||
}());
|
}());
|
||||||
var SlaveProtocol = (function () {
|
var SlaveProtocol = /** @class */ (function () {
|
||||||
function SlaveProtocol() {
|
function SlaveProtocol() {
|
||||||
}
|
}
|
||||||
Object.defineProperty(SlaveProtocol, "packetHandlers", {
|
Object.defineProperty(SlaveProtocol, "packetHandlers", {
|
||||||
|
@ -175,12 +175,12 @@ var SlaveProtocol = (function () {
|
||||||
};
|
};
|
||||||
return SlaveProtocol;
|
return SlaveProtocol;
|
||||||
}());
|
}());
|
||||||
var Rendering = (function () {
|
var Rendering = /** @class */ (function () {
|
||||||
function Rendering() {
|
function Rendering() {
|
||||||
}
|
}
|
||||||
return Rendering;
|
return Rendering;
|
||||||
}());
|
}());
|
||||||
var Connection = (function () {
|
var Connection = /** @class */ (function () {
|
||||||
function Connection(address, handles, useCipher, onOpen, onClose, onError) {
|
function Connection(address, handles, useCipher, onOpen, onClose, onError) {
|
||||||
if (useCipher === void 0) { useCipher = false; }
|
if (useCipher === void 0) { useCipher = false; }
|
||||||
if (onOpen === void 0) { onOpen = null; }
|
if (onOpen === void 0) { onOpen = null; }
|
||||||
|
@ -272,7 +272,7 @@ var Connection = (function () {
|
||||||
};
|
};
|
||||||
return Connection;
|
return Connection;
|
||||||
}());
|
}());
|
||||||
var Key = (function () {
|
var Key = /** @class */ (function () {
|
||||||
function Key() {
|
function Key() {
|
||||||
}
|
}
|
||||||
Object.defineProperty(Key, "privateKey", {
|
Object.defineProperty(Key, "privateKey", {
|
||||||
|
@ -303,10 +303,10 @@ var Key = (function () {
|
||||||
Key._privateKey = serverKey.modPow(Key.secret, modulus);
|
Key._privateKey = serverKey.modPow(Key.secret, modulus);
|
||||||
return Packet.create(1 /* KeyExchange */, [clientKey.toString(16)]);
|
return Packet.create(1 /* KeyExchange */, [clientKey.toString(16)]);
|
||||||
};
|
};
|
||||||
|
Key._privateKey = new bigInt(0);
|
||||||
return Key;
|
return Key;
|
||||||
}());
|
}());
|
||||||
Key._privateKey = new bigInt(0);
|
var Cipher = /** @class */ (function () {
|
||||||
var Cipher = (function () {
|
|
||||||
function Cipher() {
|
function Cipher() {
|
||||||
}
|
}
|
||||||
Object.defineProperty(Cipher, "ready", {
|
Object.defineProperty(Cipher, "ready", {
|
||||||
|
@ -355,10 +355,10 @@ var Cipher = (function () {
|
||||||
Cipher.close = function () {
|
Cipher.close = function () {
|
||||||
Cipher._ready = false;
|
Cipher._ready = false;
|
||||||
};
|
};
|
||||||
|
Cipher._ready = false;
|
||||||
return Cipher;
|
return Cipher;
|
||||||
}());
|
}());
|
||||||
Cipher._ready = false;
|
var Packet = /** @class */ (function () {
|
||||||
var Packet = (function () {
|
|
||||||
function Packet() {
|
function Packet() {
|
||||||
this._regions = [];
|
this._regions = [];
|
||||||
}
|
}
|
||||||
|
@ -467,9 +467,14 @@ var Packet = (function () {
|
||||||
});
|
});
|
||||||
return buffer;
|
return buffer;
|
||||||
};
|
};
|
||||||
|
Packet.magicNumber = new Uint8Array([0xB0, 0x0B]);
|
||||||
return Packet;
|
return Packet;
|
||||||
}());
|
}());
|
||||||
Packet.magicNumber = new Uint8Array([0xB0, 0x0B]);
|
var LoadingBar = /** @class */ (function () {
|
||||||
|
function LoadingBar() {
|
||||||
|
}
|
||||||
|
return LoadingBar;
|
||||||
|
}());
|
||||||
// ** STRING EXTENSIONS ** \\
|
// ** STRING EXTENSIONS ** \\
|
||||||
String.prototype.replaceAll = function (needle, replace, ignoreCase) {
|
String.prototype.replaceAll = function (needle, replace, ignoreCase) {
|
||||||
if (ignoreCase === void 0) { ignoreCase = false; }
|
if (ignoreCase === void 0) { ignoreCase = false; }
|
||||||
|
@ -619,7 +624,7 @@ bigInt.prototype.toByteArray = function (byteCount) {
|
||||||
}
|
}
|
||||||
return byteArray;
|
return byteArray;
|
||||||
};
|
};
|
||||||
var CriticalStop = (function () {
|
var CriticalStop = /** @class */ (function () {
|
||||||
function CriticalStop() {
|
function CriticalStop() {
|
||||||
}
|
}
|
||||||
CriticalStop.redirect = function (message) {
|
CriticalStop.redirect = function (message) {
|
||||||
|
@ -627,7 +632,7 @@ var CriticalStop = (function () {
|
||||||
};
|
};
|
||||||
return CriticalStop;
|
return CriticalStop;
|
||||||
}());
|
}());
|
||||||
var Random = (function () {
|
var Random = /** @class */ (function () {
|
||||||
function Random() {
|
function Random() {
|
||||||
}
|
}
|
||||||
Random.generatePrime = function (bitCount) {
|
Random.generatePrime = function (bitCount) {
|
||||||
|
|
5
client/src/ui/Loading.ts
Normal file
5
client/src/ui/Loading.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class LoadingBar {
|
||||||
|
private static bar: HTMLElement;
|
||||||
|
private static barPercent: HTMLElement;
|
||||||
|
private static barWrapper: HTMLElement;
|
||||||
|
}
|
|
@ -12,21 +12,32 @@
|
||||||
#include "utils/csprng.hpp"
|
#include "utils/csprng.hpp"
|
||||||
#include "crypto/bcrypt.hpp"
|
#include "crypto/bcrypt.hpp"
|
||||||
#include "utils/bigint.hpp"
|
#include "utils/bigint.hpp"
|
||||||
|
#include "sock/scapesock.hpp"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
sosc::TcpServer server;
|
sosc::ScapeServer server;
|
||||||
sosc::TcpClient client;
|
sosc::ScapeConnection client;
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
|
|
||||||
server.Listen(8080);
|
if(!server.Listen(8080)) {
|
||||||
|
std::cout << "Listening failed." << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
std::cout << "Listening ..." << std::endl;
|
std::cout << "Listening ..." << std::endl;
|
||||||
server.Accept(&client);
|
|
||||||
std::cout << "Reading ..." << std::endl;
|
|
||||||
|
|
||||||
while(true) {
|
server.Accept(&client);
|
||||||
client.Receive(&buffer, SOSC_TCP_BLOCK);
|
std::cout << "Shaking ..." << std::endl;
|
||||||
std::cout << buffer;
|
|
||||||
|
bool loop = true;
|
||||||
|
while(loop) {
|
||||||
|
if(!client.Handshaked())
|
||||||
|
client.Handshake();
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
//client.Receive(&buffer, SOSC_TCP_BLOCK);
|
||||||
|
//std::cout << buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server.Close();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,16 +72,16 @@ bool sosc::IntraServer::Listen(uint16_t port) {
|
||||||
return this->server.Listen(port);
|
return this->server.Listen(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sosc::IntraServer::Accept(IntraClient* client) {
|
bool sosc::IntraServer::Accept(IntraClient* client) {
|
||||||
if(!this->server_open)
|
if(!this->server_open)
|
||||||
return -1;
|
return false;
|
||||||
|
|
||||||
TcpClient new_client;
|
TcpClient new_client;
|
||||||
if(this->server.Accept(&new_client) == 0) {
|
if(this->server.Accept(&new_client) == 0) {
|
||||||
client->Open(new_client);
|
client->Open(new_client);
|
||||||
return 0;
|
return true;
|
||||||
} else
|
} else
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sosc::IntraServer::~IntraServer() {
|
sosc::IntraServer::~IntraServer() {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
IntraServer();
|
IntraServer();
|
||||||
|
|
||||||
bool Listen(uint16_t port);
|
bool Listen(uint16_t port);
|
||||||
int Accept(IntraClient* client);
|
bool Accept(IntraClient* client);
|
||||||
|
|
||||||
inline bool IsOpen() const {
|
inline bool IsOpen() const {
|
||||||
return this->server_open;
|
return this->server_open;
|
||||||
|
|
|
@ -24,8 +24,6 @@ int sosc::ScapeConnection::Handshake() {
|
||||||
return SOSC_SHAKE_CONT;
|
return SOSC_SHAKE_CONT;
|
||||||
|
|
||||||
this->client.Receive(&this->buffer, SOSC_TCP_APPEND);
|
this->client.Receive(&this->buffer, SOSC_TCP_APPEND);
|
||||||
if(!str::contains(this->buffer, "\r\n\r\n"))
|
|
||||||
return SOSC_SHAKE_CONT;
|
|
||||||
|
|
||||||
if(!str::starts(this->buffer, "GET")) {
|
if(!str::starts(this->buffer, "GET")) {
|
||||||
this->Close();
|
this->Close();
|
||||||
|
@ -34,6 +32,10 @@ int sosc::ScapeConnection::Handshake() {
|
||||||
|
|
||||||
auto lines = str::split(this->buffer, "\r\n");
|
auto lines = str::split(this->buffer, "\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
if(!str::contains(this->buffer, "\r\n\r\n"))
|
||||||
|
return SOSC_SHAKE_CONT;
|
||||||
|
|
||||||
this->handshaked = true;
|
this->handshaked = true;
|
||||||
return SOSC_SHAKE_DONE;
|
return SOSC_SHAKE_DONE;
|
||||||
}
|
}
|
||||||
|
@ -58,12 +60,15 @@ bool sosc::ScapeServer::Listen(uint16_t port) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sosc::ScapeServer::Accept(ScapeConnection* client) {
|
bool sosc::ScapeServer::Accept(ScapeConnection* client) {
|
||||||
TcpClient raw_client;
|
TcpClient raw_client;
|
||||||
int status = this->server.Accept(&raw_client);
|
if(!this->server.Accept(&raw_client))
|
||||||
if(status != 0)
|
return false;
|
||||||
return status;
|
|
||||||
|
|
||||||
|
client->Open(raw_client);
|
||||||
return 0;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sosc::ScapeServer::~ScapeServer() {
|
||||||
|
this->Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
ScapeServer();
|
ScapeServer();
|
||||||
|
|
||||||
bool Listen(uint16_t port);
|
bool Listen(uint16_t port);
|
||||||
int Accept(ScapeConnection* client);
|
bool Accept(ScapeConnection* client);
|
||||||
|
|
||||||
inline bool IsOpen() const {
|
inline bool IsOpen() const {
|
||||||
return this->server_open;
|
return this->server_open;
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
TcpServer();
|
TcpServer();
|
||||||
bool Listen(uint16_t port);
|
bool Listen(uint16_t port);
|
||||||
|
|
||||||
int Accept(TcpClient* client);
|
bool Accept(TcpClient* client);
|
||||||
|
|
||||||
void Close();
|
void Close();
|
||||||
~TcpServer();
|
~TcpServer();
|
||||||
|
|
|
@ -206,9 +206,9 @@ bool sosc::TcpServer::Listen(uint16_t port) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sosc::TcpServer::Accept(TcpClient* client) {
|
bool sosc::TcpServer::Accept(TcpClient* client) {
|
||||||
if(!this->sock_open)
|
if(!this->sock_open)
|
||||||
return -1;
|
return false;
|
||||||
|
|
||||||
SOSC_SOCK_T sock;
|
SOSC_SOCK_T sock;
|
||||||
SOSC_ADDR_T addr;
|
SOSC_ADDR_T addr;
|
||||||
|
@ -217,12 +217,12 @@ int sosc::TcpServer::Accept(TcpClient* client) {
|
||||||
sock = accept(this->sock, (struct sockaddr*)&addr, &addr_len);
|
sock = accept(this->sock, (struct sockaddr*)&addr, &addr_len);
|
||||||
if(sock < 0) {
|
if(sock < 0) {
|
||||||
this->Close();
|
this->Close();
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
client->Close();
|
client->Close();
|
||||||
client->Open(sock, addr, addr_len);
|
client->Open(sock, addr, addr_len);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sosc::TcpServer::Close() {
|
void sosc::TcpServer::Close() {
|
||||||
|
|
Loading…
Reference in a new issue