packages/shinobi: init

flake.lock: Update

Flake lock file updates:

• Added input 'shinobi':
    'gitlab:Shinobi-Systems/Shinobi/a2faa40ab0e9952ff6a7fcf682534171614180c1' (2021-11-30)
This commit is contained in:
Max Headroom 2022-03-17 20:50:30 +01:00
parent b42501d83f
commit e055e489be
17 changed files with 22697 additions and 1 deletions

View file

@ -678,7 +678,8 @@
"nix-super": "nix-super", "nix-super": "nix-super",
"nix-vsx": "nix-vsx", "nix-vsx": "nix-vsx",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"shinobi": "shinobi"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -703,6 +704,22 @@
"type": "github" "type": "github"
} }
}, },
"shinobi": {
"flake": false,
"locked": {
"lastModified": 1638289465,
"narHash": "sha256-e1x0MmLtSgatug6sva1L/Ti601Ua4KWwLb6umPEtbEU=",
"owner": "Shinobi-Systems",
"repo": "Shinobi",
"rev": "a2faa40ab0e9952ff6a7fcf682534171614180c1",
"type": "gitlab"
},
"original": {
"owner": "Shinobi-Systems",
"repo": "Shinobi",
"type": "gitlab"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1642700792, "lastModified": 1642700792,

View file

@ -39,6 +39,8 @@
dream2nix.url = "github:nix-community/dream2nix"; dream2nix.url = "github:nix-community/dream2nix";
dream2nix.inputs.nixpkgs.follows = "nixpkgs"; dream2nix.inputs.nixpkgs.follows = "nixpkgs";
shinobi = { url = "gitlab:Shinobi-Systems/Shinobi"; flake = false; };
}; };
outputs = { self, nixpkgs, home-manager, nixos-hardware, ... }@inputs: outputs = { self, nixpkgs, home-manager, nixos-hardware, ... }@inputs:
let let

View file

@ -0,0 +1,24 @@
{
lib,
pkgs,
# dream2nix
satisfiesSemver,
...
}:
{
shinobi.directory-patches = {
patches = [
./shinobi/0001-packageDirectory.patch
./shinobi/0002-use-packageDirectory-for-languages.patch
./shinobi/0003-use-s.location.languages.patch
./shinobi/0004-use-packageDirectory-for-folders.patch
./shinobi/0005-use-packageDirectory-for-definitions.patch
./shinobi/0006-use-packageDirectory-for-web-server-paths.patch
./shinobi/0007-remove-terminalCommands.patch
./shinobi/0008-use-__dirname-in-ejs.patch
./shinobi/0009-disable-subscription-bullshit.patch
];
};
}

View file

@ -0,0 +1,28 @@
From e30bec29ad5d960d8fe0e6d3427601d49d0746ea Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:15:23 +0100
Subject: [PATCH 1/9] packageDirectory
---
libs/process.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libs/process.js b/libs/process.js
index 9f3852e..b19384a 100644
--- a/libs/process.js
+++ b/libs/process.js
@@ -30,8 +30,10 @@ module.exports = function(process,__dirname){
isWin : (process.platform === 'win32' || process.platform === 'win64'),
//UTC Offset
utcOffset : require('moment')().utcOffset(),
- //directory path for this file
+ //directory path for cwd
mainDirectory : process.cwd(),
+ //directory path for this file
+ packageDirectory : require('path').resolve(__dirname),
//time start
timeStarted : new Date()
--
2.35.1

View file

@ -0,0 +1,25 @@
From 28e6412cc76855bacc63a92e019fb2cb35cba259 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:19:58 +0100
Subject: [PATCH 2/9] use packageDirectory for languages
---
libs/config.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/config.js b/libs/config.js
index 65ed5ff..d20c05b 100644
--- a/libs/config.js
+++ b/libs/config.js
@@ -2,7 +2,7 @@ module.exports = function(s){
s.location = {
super : s.mainDirectory+'/super.json',
config : s.mainDirectory+'/conf.json',
- languages : s.mainDirectory+'/languages'
+ languages : s.packageDirectory+'/languages'
}
try{
var config = require(s.location.config)
--
2.35.1

View file

@ -0,0 +1,25 @@
From 5de02cbd463bcc936907ed9af9dc13e4bd3e4f26 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:26:44 +0100
Subject: [PATCH 3/9] use s.location.languages
---
libs/language.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/language.js b/libs/language.js
index ced395a..593321e 100644
--- a/libs/language.js
+++ b/libs/language.js
@@ -16,7 +16,7 @@ module.exports = function(s,config){
return Object.assign(lang,{})
}
s.listOfPossibleLanguages = []
- fs.readdirSync(s.mainDirectory + '/languages').forEach(function(filename){
+ fs.readdirSync(s.location.languages).forEach(function(filename){
var name = filename.replace('.json','')
s.listOfPossibleLanguages.push({
"name": name,
--
2.35.1

View file

@ -0,0 +1,43 @@
From b7f4ce7fc6ee30499a26a74c25a7a580a5ba4368 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:28:48 +0100
Subject: [PATCH 4/9] use packageDirectory for folders
---
libs/folders.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libs/folders.js b/libs/folders.js
index 54f9acc..d35d337 100644
--- a/libs/folders.js
+++ b/libs/folders.js
@@ -3,7 +3,7 @@ module.exports = function(s,config,lang){
//directories
s.group = {}
if(!config.windowsTempDir&&s.isWin===true){config.windowsTempDir='C:/Windows/Temp'}
- if(!config.defaultMjpeg){config.defaultMjpeg=s.mainDirectory+'/web/libs/img/bg.jpg'}
+ if(!config.defaultMjpeg){config.defaultMjpeg=s.packageDirectory+'/web/libs/img/bg.jpg'}
//default stream folder check
if(!config.streamDir){
if(s.isWin === false){
@@ -62,7 +62,7 @@ module.exports = function(s,config,lang){
value:""
}
]
- fs.readdirSync(s.mainDirectory + '/web/libs/audio').forEach(function(file){
+ fs.readdirSync(s.packageDirectory + '/web/libs/audio').forEach(function(file){
s.listOfAudioFiles.push({
name: file,
value: file
@@ -75,7 +75,7 @@ module.exports = function(s,config,lang){
value:""
}
]
- fs.readdirSync(s.mainDirectory + '/web/libs/themes').forEach(function(folder){
+ fs.readdirSync(s.packageDirectory + '/web/libs/themes').forEach(function(folder){
s.listOfThemes.push({
name: folder,
value: folder
--
2.35.1

View file

@ -0,0 +1,25 @@
From 77d75251a0e1e3a39d0131ef0b353f36bdf4e7b2 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:35:04 +0100
Subject: [PATCH 5/9] use packageDirectory for definitions
---
libs/definitions.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/definitions.js b/libs/definitions.js
index a58a6e2..d60cad9 100644
--- a/libs/definitions.js
+++ b/libs/definitions.js
@@ -1,7 +1,7 @@
var fs = require('fs')
var express = require('express')
module.exports = function(s,config,lang,app,io){
- s.location.definitions = s.mainDirectory+'/definitions'
+ s.location.definitions = s.packageDirectory+'/definitions'
try{
var definitions = require(s.location.definitions+'/'+config.language+'.js')(s,config,lang)
}catch(er){
--
2.35.1

View file

@ -0,0 +1,61 @@
From fc54751d467c214c33178b04c128a13148c54ccb Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:48:34 +0100
Subject: [PATCH 6/9] use packageDirectory for web server paths
---
libs/webServerPaths.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libs/webServerPaths.js b/libs/webServerPaths.js
index 8e5b29e..56ef9f6 100644
--- a/libs/webServerPaths.js
+++ b/libs/webServerPaths.js
@@ -73,21 +73,21 @@ module.exports = function(s,config,lang,app,io){
////Pages
app.enable('trust proxy');
if(config.webPaths.home !== '/'){
- app.use('/libs',express.static(s.mainDirectory + '/web/libs'))
+ app.use('/libs',express.static(s.packageDirectory + '/web/libs'))
}
- app.use(s.checkCorrectPathEnding(config.webPaths.home)+'libs',express.static(s.mainDirectory + '/web/libs'))
- app.use(s.checkCorrectPathEnding(config.webPaths.admin)+'libs',express.static(s.mainDirectory + '/web/libs'))
- app.use(s.checkCorrectPathEnding(config.webPaths.super)+'libs',express.static(s.mainDirectory + '/web/libs'))
+ app.use(s.checkCorrectPathEnding(config.webPaths.home)+'libs',express.static(s.packageDirectory + '/web/libs'))
+ app.use(s.checkCorrectPathEnding(config.webPaths.admin)+'libs',express.static(s.packageDirectory + '/web/libs'))
+ app.use(s.checkCorrectPathEnding(config.webPaths.super)+'libs',express.static(s.packageDirectory + '/web/libs'))
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(function (req,res,next){
res.header("Access-Control-Allow-Origin",'*');
next()
})
- app.set('views', s.mainDirectory + '/web');
+ app.set('views', s.packageDirectory + '/web');
app.set('view engine','ejs');
//add template handler
- if(config.renderPaths.handler!==undefined){require(s.mainDirectory+'/web/'+config.renderPaths.handler+'.js').addHandlers(s,app,io,config)}
+ if(config.renderPaths.handler!==undefined){require(s.packageDirectory+'/web/'+config.renderPaths.handler+'.js').addHandlers(s,app,io,config)}
/**
* API : Logout
@@ -328,7 +328,7 @@ module.exports = function(s,config,lang,app,io){
define: s.getDefinitonFile(userInfo.details.lang),
addStorage: s.dir.addStorage,
fs: fs,
- __dirname: s.mainDirectory,
+ __dirname: s.packageDirectory,
customAutoLoad: s.customAutoLoadTree
})
break;
@@ -1771,6 +1771,6 @@ module.exports = function(s,config,lang,app,io){
res.on('finish',function(){
res.end()
})
- fs.createReadStream(s.mainDirectory + '/web/pages/robots.txt').pipe(res)
+ fs.createReadStream(s.packageDirectory + '/web/pages/robots.txt').pipe(res)
})
}
--
2.35.1

View file

@ -0,0 +1,37 @@
From 9ea5979b0c2731604c0b2d519a929b5b920f9eb4 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 18:51:47 +0100
Subject: [PATCH 7/9] remove terminalCommands
---
libs/startup.js | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/libs/startup.js b/libs/startup.js
index 47d338b..b67ecb9 100644
--- a/libs/startup.js
+++ b/libs/startup.js
@@ -29,19 +29,7 @@ module.exports = function(s,config,lang,io){
var next = function(){
if(callback)callback()
}
- if(!s.isWin && s.packageJson.mainDirectory !== '.'){
- var etcPath = '/etc/shinobisystems/cctv.txt'
- fs.stat(etcPath,function(err,stat){
- if(err || !stat){
- exec('node '+ s.mainDirectory + '/INSTALL/terminalCommands.js',function(err){
- if(err)console.log(err)
- })
- }
- next()
- })
- }else{
- next()
- }
+ next()
}
var loadedAccounts = []
var foundMonitors = []
--
2.35.1

View file

@ -0,0 +1,23 @@
From 978dd533a08cc1155819be65598055f7232ad8c8 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 19:18:02 +0100
Subject: [PATCH 8/9] use __dirname in ejs
---
web/pages/blocks/settings.ejs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/pages/blocks/settings.ejs b/web/pages/blocks/settings.ejs
index 39d1b9b..7baed45 100644
--- a/web/pages/blocks/settings.ejs
+++ b/web/pages/blocks/settings.ejs
@@ -1,5 +1,5 @@
<!--Settings Window-->
-<% var audioFiles = fs.readdirSync('./web/libs/audio') %>
+<% var audioFiles = fs.readdirSync(__dirname + '/web/libs/audio') %>
<div class="modal fade medium dark" id="settings" tabindex="-1" role="dialog" aria-labelledby="settingsLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<form class="modal-content">
--
2.35.1

View file

@ -0,0 +1,48 @@
From 780f773004680b633cfc5c5f59cb320c58676947 Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Tue, 15 Mar 2022 21:38:42 +0100
Subject: [PATCH 9/9] disable subscription bullshit
---
libs/startup.js | 4 ++--
libs/webServerSuperPaths.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libs/startup.js b/libs/startup.js
index b67ecb9..b06abb1 100644
--- a/libs/startup.js
+++ b/libs/startup.js
@@ -380,7 +380,7 @@ module.exports = function(s,config,lang,io){
}
})
}
- config.userHasSubscribed = false
+ config.userHasSubscribed = true
//check disk space every 20 minutes
if(config.autoDropCache===true){
setInterval(function(){
@@ -400,7 +400,7 @@ module.exports = function(s,config,lang,io){
setTimeout(() => {
//check for subscription
checkSubscription(config.subscriptionId,function(hasSubcribed){
- config.userHasSubscribed = hasSubcribed
+ config.userHasSubscribed = true
//check terminal commander
checkForTerminalCommands(function(){
//load administrators (groups)
diff --git a/libs/webServerSuperPaths.js b/libs/webServerSuperPaths.js
index bfbccf9..1d1bf3b 100644
--- a/libs/webServerSuperPaths.js
+++ b/libs/webServerSuperPaths.js
@@ -167,7 +167,7 @@ module.exports = function(s,config,lang,app){
}
checkSubscription(subscriptionId,function(hasSubcribed){
endData.ok = hasSubcribed
- config.userHasSubscribed = hasSubcribed
+ config.userHasSubscribed = true
s.closeJsonResponse(res,endData)
})
},res,req)
--
2.35.1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -23,5 +23,11 @@ in
neovim-gtk = pkgs.callPackage ./apps/neovim-gtk { }; neovim-gtk = pkgs.callPackage ./apps/neovim-gtk { };
shinobi = let
dream = dream2nix.makeFlakeOutputs {
source = inputs.shinobi;
};
in dream.packages.${pkgs.system}.shinobi // { inherit (dream.apps.${pkgs.system}) resolveImpure; };
steam-metro-skin = import ./data/misc/steam-metro-skin { inherit (pkgs) fetchzip; }; steam-metro-skin = import ./data/misc/steam-metro-skin { inherit (pkgs) fetchzip; };
} }