9 Commits

Author SHA1 Message Date
0cea6eb4ca Version bump to v0.1.4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-11-04 18:25:29 -04:00
d1268fe708 Fixed system config in /etc
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-11-04 18:23:29 -04:00
ff92316e1e Updated the systemd unit file to load the proper config file
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-11-04 18:17:29 -04:00
629a7df3c4 Version bump to v0.1.3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-11-04 18:08:08 -04:00
30e23caf7f Added config options to define what host address and port to listen on
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-04 18:07:44 -04:00
9afe8c5391 Version bump v0.1.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-11-04 17:59:25 -04:00
e958080702 Fixed some linter issues
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-11-04 17:54:43 -04:00
6455f3ff10 Changed to Grunt.js for task running
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-11-04 17:53:42 -04:00
1536c0721d Added preliminary code for the express-flasher flash message integration - will uncomment code tomorrow when package can be published
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-11-04 17:30:17 -04:00
12 changed files with 973 additions and 6118 deletions

View File

@ -3,6 +3,7 @@ pipeline:
image: node:18
commands:
- npm install
- npm run grunt
lint:
image: node:18

View File

@ -4,6 +4,51 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed'
},
files: [{
expand: true,
cwd: 'assets/styles',
src: ['**/*.scss'],
dest: 'public/css',
ext: '.css'
}]
}
},
uglify: {
options: {
mangle: false
},
compile: {
files: {
'public/js/nechryael.min.js': ['assets/js/**/*.js']
}
}
},
watch: {
css: {
files: ['assets/styles/**/*.scss'],
tasks: ['sass'],
options: {
atBegin: true,
spawn: false
}
},
js: {
files: ['assets/js/**/*.js'],
tasks: ['uglify'],
options: {
atBegin: true,
spawn: false
}
}
},
deb_package: {
options: {
maintainer: 'Gregory Ballantine <gballantine@bitgoblin.tech>',
@ -39,7 +84,7 @@ module.exports = function(grunt) {
},
{
cwd: './build/etc/',
src: 'production.json',
src: 'default.json',
dest: '/etc/overseer/'
},
{
@ -75,10 +120,14 @@ module.exports = function(grunt) {
}
});
// Load the plugin that provides the "uglify" task.
// Load plugins.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-deb');
// Default task(s).
// CLI tasks.
grunt.registerTask('default', ['sass', 'uglify']);
grunt.registerTask('package', ['deb_package']);
};

3
assets/js/nechryael.js Normal file
View File

@ -0,0 +1,3 @@
$(document).ready(function() {
console.log('Document is ready!');
});

View File

@ -1,4 +1,8 @@
{
"server": {
"address": "0.0.0.0",
"port": 3000
},
"database": {
"driver": "sqlite",
"connection_string": "/opt/overseer/data/overseer.db"

View File

@ -4,6 +4,7 @@ Description=Overseer inventory tracking app
[Service]
User=overseer
Group=overseer
Environment="NODE_CONFIG_DIR=/etc/overseer"
ExecStart=/usr/bin/overseer
SuccessExitStatus=143

View File

@ -1,4 +1,8 @@
{
"server": {
"address": "0.0.0.0",
"port": 3000
},
"database": {
"driver": "sqlite",
"connection_string": "data/overseer.db"

View File

@ -1,17 +0,0 @@
const gulp = require('gulp');
const { watch } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
// compile
function styles(cb) {
return gulp.src('./assets/styles/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest('./public/css'));
cb();
}
// by default, watch files
exports.default = function() {
// compile sass stylesheets
watch('assets/styles/**/*.scss', styles);
};

View File

@ -1,8 +1,10 @@
const express = require('express');
const session = require('express-session');
// const flash = require('express-flasher');
// instantiate new express.js app
const app = express();
const port = 3000;
const config = require('config');
// initialize database connection
(async () => {
@ -12,6 +14,17 @@ const port = 3000;
});
})();
// initialize express.js session
app.use(session({
resave: false, // don't save session if unmodified
saveUninitialized: false, // don't create session until something stored
secret: 'lord of the rings',
}));
// setup flash messaging
// app.use(flash.flash());
// app.use(flash.flashRead());
// set up body POST parameters
app.use(express.json());
app.use(express.urlencoded({
@ -37,6 +50,6 @@ app.get('/item/:id/edit', itemRoutes.getItemEdit);
app.post('/item/:id/edit', itemRoutes.postItemEdit);
// start app
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
app.listen(config.get('server.port'), config.get('server.address'), () => {
console.log(`Overseer is listening on port ${config.get('server.port')}.`);
});

6963
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
{
"name": "overseer",
"version": "0.1.1",
"version": "0.1.4",
"description": "Self-hosted inventory tracker",
"main": "index.js",
"scripts": {
"start": "node index.js",
"grunt": "grunt",
"gulp": "gulp",
"nodemon": "nodemon index.js",
"lint": "eslint index.js src/**/*.js",
"test": "echo \"Error: no test specified\" && exit 1"
@ -21,7 +20,10 @@
],
"author": "Gregory Ballanine <gballantine@bitgoblin.tech>",
"uploaders": [
{ "name": "Gregory Ballantine", "email": "gballantine@bitgoblin.tech" }
{
"name": "Gregory Ballantine",
"email": "gballantine@bitgoblin.tech"
}
],
"license": "BSD-2-Clause",
"devDependencies": {
@ -29,15 +31,17 @@
"eslint-config-google": "^0.14.0",
"grunt": "^1.5.3",
"grunt-cli": "^1.4.3",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-deb": "^0.2.5",
"gulp": "^4.0.2",
"gulp-sass": "^5.1.0",
"nodemon": "^2.0.20",
"sass": "^1.55.0"
},
"dependencies": {
"config": "^3.3.8",
"express": "^4.18.2",
"express-session": "^1.17.3",
"sequelize": "^6.25.3",
"sqlite3": "^5.1.2",
"twig": "^1.15.4"

View File

@ -10,6 +10,8 @@ exports.getIndex = async function(req, res) {
],
});
// req.flash('info', 'This is a test flash message.');
res.render('index.twig', {
inventory: items,
});

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
<link rel="stylesheet" href="/css/gargoyle.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script src="/js/drake.js"></script>
<script src="/js/nechryael.min.js"></script>
</head>
<body>
<!-- global navigation -->
@ -24,6 +24,12 @@
</div>
</nav>
{% if flash != null %}
<div class="flash-message {{ flash.type }}">
<p>{{ flash.msg }}</p>
</div>
{% endif %}
<!-- main content -->
<div id="main-content" class="container fluid">
{% block content %}{% endblock %}