This commit is contained in:
Eason010212
2023-02-18 12:00:14 +08:00
parent 4ca5553815
commit 68b1ca15f2
592 changed files with 53 additions and 112 deletions

View File

@@ -1,6 +1,6 @@
{
"MIXIO_HTTP_PORT": 8080,
"MIXIO_HTTPS_PORT": 443,
"MIXIO_HTTPS_PORT": 8081,
"HTTPS_PRIVATE_PEM": "./certs/private.pem",
"HTTPS_CRT_FILE": "./certs/file.crt",
"MAX_PROJECT_NUM_PER_USER": 20,

View File

@@ -17,8 +17,16 @@ const { execPath } = require('process');
var { JSLang, arrLang, lang } = require("./js/lang.js")
const path = require('path');
var VERSION = JSON.parse(fs.readFileSync("../version.json", "utf-8"))["version"]
var configs = fs.readFileSync('./config.json');
var versionPath = "../version.json"
if(!fs.existsSync(versionPath)){
versionPath = path.join(__dirname,"../version.json")
}
var VERSION = JSON.parse(fs.readFileSync(versionPath), "utf-8")["version"]
var configPath = "./config.json"
if(!fs.existsSync(configPath)){
configPath = path.join(__dirname,"./config.json")
}
var configs = fs.readFileSync(configPath);
configs = JSON.parse(configs.toString());
@@ -224,7 +232,7 @@ async function daemon_start() {
app.get('/saveAndRestart', async function(req, res) {
newConfig = req.query.configs
if (newConfig) {
fs.writeFileSync('./config.json', newConfig)
fs.writeFileSync(configPath, newConfig)
configs = JSON.parse(newConfig)
console.log("[INFO] Shutting down MixIO Server...")
await mixio.stop();
@@ -301,15 +309,25 @@ async function daemon_start() {
}
var mixioServer = function() {
var privateKey = fs.readFileSync(configs['HTTPS_PRIVATE_PEM'], 'utf8');
var certificate = fs.readFileSync(configs['HTTPS_CRT_FILE'], 'utf8');
var keyPath = "./certs/private.pem"
if(!fs.existsSync(keyPath))
keyPath = path.join(__dirname,"./certs/private.pem")
var crtPath = "./certs/file.crt"
if(!fs.existsSync(crtPath))
crtPath = path.join(__dirname,"./certs/file.crt")
var privateKey = fs.readFileSync(keyPath, 'utf8');
var certificate = fs.readFileSync(crtPath, 'utf8');
var credentials = {
key: privateKey,
cert: certificate
};
if(fs.existsSync("./certs/chain.crt"))
credentials['ca'] = fs.readFileSync("./certs/chain.crt", 'utf8')
var chainPath = "./certs/chain.crt"
if(!fs.existsSync(chainPath))
chainPath = path.join(__dirname,"./certs/chain.crt")
if(fs.existsSync(chainPath))
credentials['ca'] = fs.readFileSync(chainPath, 'utf8')
aedes = aedesmodule()
const httpServer = http.createServer()
@@ -1415,10 +1433,13 @@ var mixioServer = function() {
}
})
var filterPath = "./reserve/filter.json"
if(!fs.existsSync(filterPath))
filterPath = path.join(__dirname,'./reserve/filter.json')
app.get('/startHook', function(req, res) {
if (req.session.userName) {
reserveJSON[req.session.userName] = true
fs.writeFileSync('./reserve/filter.json', JSON.stringify(reserveJSON, false, 4))
fs.writeFileSync(filterPath, JSON.stringify(reserveJSON, false, 4))
res.send('1')
} else {
res.send('0')
@@ -1428,7 +1449,7 @@ var mixioServer = function() {
app.get('/stopHook', function(req, res) {
if (req.session.userName) {
reserveJSON[req.session.userName] = false
fs.writeFileSync('./reserve/filter.json', JSON.stringify(reserveJSON, false, 4))
fs.writeFileSync(filterPath, JSON.stringify(reserveJSON, false, 4))
res.send('1')
} else {
res.send('0')
@@ -1482,13 +1503,20 @@ var mixioServer = function() {
app.use('/documentation', express.static(path.join(__dirname, 'documentation')));
if(fs.existsSync('./mixly')){
app.use('/mixly', express.static(path.join(__dirname, 'mixly')));
var mixlyPath = "./mixly"
if(!fs.existsSync(mixlyPath)) {
mixlyPath = path.join(__dirname,'./mixly')
}
if(fs.existsSync(mixlyPath)){
app.use('/mixly', express.static(mixlyPath));
}
var dbPath = "./mixio.db"
if(!fs.existsSync(dbPath)) {
dbPath = path.join(__dirname,'./mixio.db')
}
db = new sqlite3.Database(
'./mixio.db',
dbPath,
sqlite3.OPEN_READWRITE,
function(err) {
if (err) {
@@ -1501,9 +1529,13 @@ var mixioServer = function() {
reserveDBs = []
for (var i = 1; i <= 8; i = i + 1) {
var dbPath = "./reserve/" + i + ".db"
if(!fs.existsSync(dbPath)) {
dbPath = path.join(__dirname,'./reserve/' + i + ".db")
}
reserveDBs.push(
new sqlite3.Database(
'./reserve/' + i + ".db",
dbPath,
sqlite3.OPEN_READWRITE,
function(err) {
if (err)
@@ -1512,8 +1544,7 @@ var mixioServer = function() {
)
)
}
var reserveJSON = JSON.parse(fs.readFileSync('./reserve/filter.json'), "utf8")
var reserveJSON = JSON.parse(fs.readFileSync(filterPath), "utf8")
return new Promise(resolve => {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

View File

@@ -1,9 +0,0 @@
.blocklyTable {
vertical-align: top;
}
.blocklyTree .blocklyActiveDescendant > label,
.blocklyTree .blocklyActiveDescendant > div > label,
.blocklyActiveDescendant > button,
.blocklyActiveDescendant > input {
outline: 2px dotted #00f;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -1,11 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 14 32 18" width="32" height="4" fill="#f20" preserveAspectRatio="none">
<path opacity="0.8" transform="translate(0 0)" d="M2 14 V18 H6 V14z">
<animateTransform attributeName="transform" type="translate" values="0 0; 24 0; 0 0" dur="2s" begin="0" repeatCount="indefinite" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" />
</path>
<path opacity="0.5" transform="translate(0 0)" d="M0 14 V18 H8 V14z">
<animateTransform attributeName="transform" type="translate" values="0 0; 24 0; 0 0" dur="2s" begin="0.1s" repeatCount="indefinite" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" />
</path>
<path opacity="0.25" transform="translate(0 0)" d="M0 14 V18 H8 V14z">
<animateTransform attributeName="transform" type="translate" values="0 0; 24 0; 0 0" dur="2s" begin="0.2s" repeatCount="indefinite" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" />
</path>
</svg>

Before

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show More