mirror of
https://github.com/spacedeck/spacedeck-open.git
synced 2025-12-16 01:47:30 +01:00
Port Backend to SQLite/Sequelize (removes MongoDB), Support Electron (#14)
* The MongoDB/Mongoose data storage is removed in favor of Sequelize. This abstracts over SQLite or RDBMs like PostgreSQL and MSSQL. The default is SQLite, which significantly simplifies deployments in end-user environments. * As Spacedeck now has no more mandatory server dependencies, we can wrap it in Electron and ship it as a desktop application. * Removes docker-compose.yml * First version of import UI
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
require('../models/schema');
|
||||
var config = require('config');
|
||||
var phantom = require('node-phantom-simple');
|
||||
const db = require('../models/db');
|
||||
const config = require('config');
|
||||
const phantom = require('node-phantom-simple');
|
||||
const os = require('os');
|
||||
|
||||
module.exports = {
|
||||
// type = "pdf" or "png"
|
||||
@@ -10,7 +11,7 @@ module.exports = {
|
||||
var spaceId = space._id;
|
||||
var space_url = config.get("endpoint")+"/api/spaces/"+spaceId+"/html";
|
||||
|
||||
var export_path = "/tmp/"+spaceId+"."+type;
|
||||
var export_path = os.tmpdir()+"/"+spaceId+"."+type;
|
||||
|
||||
var timeout = 5000;
|
||||
if (type=="pdf") timeout = 30000;
|
||||
@@ -24,7 +25,7 @@ module.exports = {
|
||||
|
||||
var on_exit = function(exit_code) {
|
||||
if (exit_code>0) {
|
||||
console.log("phantom abnormal exit for url "+space_url);
|
||||
console.error("phantom abnormal exit for url "+space_url);
|
||||
if (!on_success_called && on_error) {
|
||||
on_error();
|
||||
}
|
||||
@@ -32,16 +33,16 @@ module.exports = {
|
||||
};
|
||||
|
||||
phantom.create({ path: require('phantomjs-prebuilt').path }, function (err, browser) {
|
||||
if(err){
|
||||
console.log(err);
|
||||
}else{
|
||||
if (err) {
|
||||
console.error(err);
|
||||
} else {
|
||||
return browser.createPage(function (err, page) {
|
||||
console.log("page created, opening ",space_url);
|
||||
|
||||
if (type=="pdf") {
|
||||
var psz = {
|
||||
width: space.advanced.width+"px",
|
||||
height: space.advanced.height+"px"
|
||||
width: space.width+"px",
|
||||
height: space.height+"px"
|
||||
};
|
||||
page.set('paperSize', psz);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user