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>
|
||||
<div id="loading-page-bar">
|
||||
<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>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var SockContext = (function () {
|
||||
var SockContext = /** @class */ (function () {
|
||||
function SockContext() {
|
||||
}
|
||||
Object.defineProperty(SockContext, "masterSock", {
|
||||
|
@ -19,10 +19,10 @@ var SockContext = (function () {
|
|||
if (this.didInit)
|
||||
return;
|
||||
};
|
||||
SockContext.didInit = false;
|
||||
return SockContext;
|
||||
}());
|
||||
SockContext.didInit = false;
|
||||
var Entrypoint = (function () {
|
||||
var Entrypoint = /** @class */ (function () {
|
||||
function Entrypoint() {
|
||||
}
|
||||
Entrypoint.initCheck = function () {
|
||||
|
@ -54,13 +54,13 @@ var Entrypoint = (function () {
|
|||
Entrypoint.ready = function () {
|
||||
//alert("ready");
|
||||
};
|
||||
return Entrypoint;
|
||||
}());
|
||||
Entrypoint.initStatus = {
|
||||
keyInit: false,
|
||||
fileCache: false
|
||||
};
|
||||
var FileCache = (function () {
|
||||
return Entrypoint;
|
||||
}());
|
||||
var FileCache = /** @class */ (function () {
|
||||
function FileCache() {
|
||||
}
|
||||
FileCache.initCache = function (success, error) {
|
||||
|
@ -125,15 +125,15 @@ var FileCache = (function () {
|
|||
store = query.objectStore("metadata");
|
||||
store.delete(fileName);
|
||||
};
|
||||
FileCache.dbHandle = null;
|
||||
return FileCache;
|
||||
}());
|
||||
FileCache.dbHandle = null;
|
||||
var FileMeta = (function () {
|
||||
var FileMeta = /** @class */ (function () {
|
||||
function FileMeta() {
|
||||
}
|
||||
return FileMeta;
|
||||
}());
|
||||
var MasterProtocol = (function () {
|
||||
var MasterProtocol = /** @class */ (function () {
|
||||
function MasterProtocol() {
|
||||
}
|
||||
Object.defineProperty(MasterProtocol, "packetHandlers", {
|
||||
|
@ -158,7 +158,7 @@ var MasterProtocol = (function () {
|
|||
};
|
||||
return MasterProtocol;
|
||||
}());
|
||||
var SlaveProtocol = (function () {
|
||||
var SlaveProtocol = /** @class */ (function () {
|
||||
function SlaveProtocol() {
|
||||
}
|
||||
Object.defineProperty(SlaveProtocol, "packetHandlers", {
|
||||
|
@ -175,12 +175,12 @@ var SlaveProtocol = (function () {
|
|||
};
|
||||
return SlaveProtocol;
|
||||
}());
|
||||
var Rendering = (function () {
|
||||
var Rendering = /** @class */ (function () {
|
||||
function Rendering() {
|
||||
}
|
||||
return Rendering;
|
||||
}());
|
||||
var Connection = (function () {
|
||||
var Connection = /** @class */ (function () {
|
||||
function Connection(address, handles, useCipher, onOpen, onClose, onError) {
|
||||
if (useCipher === void 0) { useCipher = false; }
|
||||
if (onOpen === void 0) { onOpen = null; }
|
||||
|
@ -272,7 +272,7 @@ var Connection = (function () {
|
|||
};
|
||||
return Connection;
|
||||
}());
|
||||
var Key = (function () {
|
||||
var Key = /** @class */ (function () {
|
||||
function Key() {
|
||||
}
|
||||
Object.defineProperty(Key, "privateKey", {
|
||||
|
@ -303,10 +303,10 @@ var Key = (function () {
|
|||
Key._privateKey = serverKey.modPow(Key.secret, modulus);
|
||||
return Packet.create(1 /* KeyExchange */, [clientKey.toString(16)]);
|
||||
};
|
||||
Key._privateKey = new bigInt(0);
|
||||
return Key;
|
||||
}());
|
||||
Key._privateKey = new bigInt(0);
|
||||
var Cipher = (function () {
|
||||
var Cipher = /** @class */ (function () {
|
||||
function Cipher() {
|
||||
}
|
||||
Object.defineProperty(Cipher, "ready", {
|
||||
|
@ -355,10 +355,10 @@ var Cipher = (function () {
|
|||
Cipher.close = function () {
|
||||
Cipher._ready = false;
|
||||
};
|
||||
Cipher._ready = false;
|
||||
return Cipher;
|
||||
}());
|
||||
Cipher._ready = false;
|
||||
var Packet = (function () {
|
||||
var Packet = /** @class */ (function () {
|
||||
function Packet() {
|
||||
this._regions = [];
|
||||
}
|
||||
|
@ -467,9 +467,14 @@ var Packet = (function () {
|
|||
});
|
||||
return buffer;
|
||||
};
|
||||
Packet.magicNumber = new Uint8Array([0xB0, 0x0B]);
|
||||
return Packet;
|
||||
}());
|
||||
Packet.magicNumber = new Uint8Array([0xB0, 0x0B]);
|
||||
var LoadingBar = /** @class */ (function () {
|
||||
function LoadingBar() {
|
||||
}
|
||||
return LoadingBar;
|
||||
}());
|
||||
// ** STRING EXTENSIONS ** \\
|
||||
String.prototype.replaceAll = function (needle, replace, ignoreCase) {
|
||||
if (ignoreCase === void 0) { ignoreCase = false; }
|
||||
|
@ -619,7 +624,7 @@ bigInt.prototype.toByteArray = function (byteCount) {
|
|||
}
|
||||
return byteArray;
|
||||
};
|
||||
var CriticalStop = (function () {
|
||||
var CriticalStop = /** @class */ (function () {
|
||||
function CriticalStop() {
|
||||
}
|
||||
CriticalStop.redirect = function (message) {
|
||||
|
@ -627,7 +632,7 @@ var CriticalStop = (function () {
|
|||
};
|
||||
return CriticalStop;
|
||||
}());
|
||||
var Random = (function () {
|
||||
var Random = /** @class */ (function () {
|
||||
function Random() {
|
||||
}
|
||||
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 "crypto/bcrypt.hpp"
|
||||
#include "utils/bigint.hpp"
|
||||
#include "sock/scapesock.hpp"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
sosc::TcpServer server;
|
||||
sosc::TcpClient client;
|
||||
sosc::ScapeServer server;
|
||||
sosc::ScapeConnection client;
|
||||
std::string buffer;
|
||||
|
||||
server.Listen(8080);
|
||||
if(!server.Listen(8080)) {
|
||||
std::cout << "Listening failed." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::cout << "Listening ..." << std::endl;
|
||||
server.Accept(&client);
|
||||
std::cout << "Reading ..." << std::endl;
|
||||
|
||||
while(true) {
|
||||
client.Receive(&buffer, SOSC_TCP_BLOCK);
|
||||
std::cout << buffer;
|
||||
server.Accept(&client);
|
||||
std::cout << "Shaking ..." << std::endl;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -72,16 +72,16 @@ bool sosc::IntraServer::Listen(uint16_t port) {
|
|||
return this->server.Listen(port);
|
||||
}
|
||||
|
||||
int sosc::IntraServer::Accept(IntraClient* client) {
|
||||
bool sosc::IntraServer::Accept(IntraClient* client) {
|
||||
if(!this->server_open)
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
TcpClient new_client;
|
||||
if(this->server.Accept(&new_client) == 0) {
|
||||
client->Open(new_client);
|
||||
return 0;
|
||||
return true;
|
||||
} else
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
sosc::IntraServer::~IntraServer() {
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
IntraServer();
|
||||
|
||||
bool Listen(uint16_t port);
|
||||
int Accept(IntraClient* client);
|
||||
bool Accept(IntraClient* client);
|
||||
|
||||
inline bool IsOpen() const {
|
||||
return this->server_open;
|
||||
|
|
|
@ -24,8 +24,6 @@ int sosc::ScapeConnection::Handshake() {
|
|||
return SOSC_SHAKE_CONT;
|
||||
|
||||
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")) {
|
||||
this->Close();
|
||||
|
@ -34,6 +32,10 @@ int sosc::ScapeConnection::Handshake() {
|
|||
|
||||
auto lines = str::split(this->buffer, "\r\n");
|
||||
|
||||
|
||||
if(!str::contains(this->buffer, "\r\n\r\n"))
|
||||
return SOSC_SHAKE_CONT;
|
||||
|
||||
this->handshaked = true;
|
||||
return SOSC_SHAKE_DONE;
|
||||
}
|
||||
|
@ -58,12 +60,15 @@ bool sosc::ScapeServer::Listen(uint16_t port) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int sosc::ScapeServer::Accept(ScapeConnection* client) {
|
||||
bool sosc::ScapeServer::Accept(ScapeConnection* client) {
|
||||
TcpClient raw_client;
|
||||
int status = this->server.Accept(&raw_client);
|
||||
if(status != 0)
|
||||
return status;
|
||||
if(!this->server.Accept(&raw_client))
|
||||
return false;
|
||||
|
||||
|
||||
return 0;
|
||||
client->Open(raw_client);
|
||||
return true;
|
||||
}
|
||||
|
||||
sosc::ScapeServer::~ScapeServer() {
|
||||
this->Close();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
ScapeServer();
|
||||
|
||||
bool Listen(uint16_t port);
|
||||
int Accept(ScapeConnection* client);
|
||||
bool Accept(ScapeConnection* client);
|
||||
|
||||
inline bool IsOpen() const {
|
||||
return this->server_open;
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
TcpServer();
|
||||
bool Listen(uint16_t port);
|
||||
|
||||
int Accept(TcpClient* client);
|
||||
bool Accept(TcpClient* client);
|
||||
|
||||
void Close();
|
||||
~TcpServer();
|
||||
|
|
|
@ -206,9 +206,9 @@ bool sosc::TcpServer::Listen(uint16_t port) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int sosc::TcpServer::Accept(TcpClient* client) {
|
||||
bool sosc::TcpServer::Accept(TcpClient* client) {
|
||||
if(!this->sock_open)
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
SOSC_SOCK_T sock;
|
||||
SOSC_ADDR_T addr;
|
||||
|
@ -217,12 +217,12 @@ int sosc::TcpServer::Accept(TcpClient* client) {
|
|||
sock = accept(this->sock, (struct sockaddr*)&addr, &addr_len);
|
||||
if(sock < 0) {
|
||||
this->Close();
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
client->Close();
|
||||
client->Open(sock, addr, addr_len);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void sosc::TcpServer::Close() {
|
||||
|
|
Loading…
Reference in a new issue