Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Node CI

on:
push:
branches: [ main, master ]
pull_request:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"chat.tools.terminal.autoApprove": {
"npm test": true
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Do not install this atop an existing MineOS system (using the Python-based webui

Using an apt-get based Linux distribution:

curl -sL https://deb.nodesource.com/setup_8.x | bash -
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get update
apt-get install -y nodejs git rdiff-backup screen build-essential openjdk-8-jre-headless
apt-get install -y nodejs git rdiff-backup screen build-essential openjdk-17-jre-headless
mkdir -p /usr/games
cd /usr/games
git clone https://github.com/hexparrot/mineos-node.git minecraft
Expand Down
24 changes: 12 additions & 12 deletions auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ auth.authenticate_shadow = function(user, plaintext, callback) {
})
}

function posix(inner_callback) {
function system_passwd(inner_callback) {
// return true if error, false if auth failed, string for user if successful
try {
var crypt = require('apache-crypt');
var posix = require('posix');
var systemUsers = require('./system-users');
} catch (e) {
inner_callback(true);
return;
}

try {
var user_data = posix.getpwnam(user);
if (crypt(plaintext, user_data.passwd) == user_data.passwd)
var password_hash = systemUsers.password(user);
if (crypt(plaintext, password_hash) == password_hash)
inner_callback(user);
else if (user_data) {
else if (password_hash) {
// the crypt hash method fails on FreeNAS so try the sha512
var password_parts = user_data.passwd.split(/\$/);
var password_parts = password_hash.split(/\$/);
var salt = password_parts[2];
var new_hash = hash.sha512crypt(plaintext, salt);

var passed = (new_hash == user_data.passwd ? user : false);
var passed = (new_hash == password_hash ? user : false);
inner_callback(passed);
} else
inner_callback(false);
Expand Down Expand Up @@ -86,9 +86,9 @@ auth.authenticate_shadow = function(user, plaintext, callback) {
if (typeof etc_passed == 'string')
callback(etc_passed)
else
posix(function(posix_passed) {
if (typeof posix_passed == 'string')
callback(posix_passed)
system_passwd(function(passwd_passed) {
if (typeof passwd_passed == 'string')
callback(passwd_passed);
else
callback(false);
})
Expand All @@ -98,14 +98,14 @@ auth.authenticate_shadow = function(user, plaintext, callback) {

auth.test_membership = function(username, group, callback) {
var passwd = require('etc-passwd');
var userid = require('userid');
var systemUsers = require('./system-users');

var membership_valid = false;
var gg = passwd.getGroups()
.on('group', function(group_data) {
if (group == group_data.groupname)
try {
if (group_data.users.indexOf(username) >= 0 || group_data.gid == userid.gids(username)[0])
if (group_data.users.indexOf(username) >= 0 || systemUsers.gids(username).indexOf(Number(group_data.gid)) >= 0)
membership_valid = true;
} catch (e) {}
})
Expand Down
12 changes: 12 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MineOS Dashboard</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "mineos-frontend",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"socket.io-client": "^4.8.1",
"vue": "^3.5.0"
},
"devDependencies": {
"vite": "^5.4.0",
"@vitejs/plugin-vue": "^5.0.0"
}
}
Loading