Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

jbackupmanager

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jbackupmanager - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+33
-17
app/controllers/crons_controller.js
load('application');
var cronjob = require('cron').CronJob;
var akeeba = require('akeebabackup');
before(loadCron, {

@@ -18,18 +21,15 @@ only: ['show', 'edit', 'update', 'destroy']

if (!err && cron) {
if (compound.cronjobs[cron.id]) {
compound.cronjobs[cron.id].stop();
compound.cronjobs[cron.id] = new cronjob(
cron.cron,
function() {
this.cron_id = cron.id;
site.backup(compound.socket, cron.id);
},
function() {
compound.cronjobs[cron.id] = new cronjob(
cron.cron,
function() {
this.cron_id = cron.id;
site.backup(compound.socket, cron.id);
},
function() {
},
true, // Start now
null,
cron // Context
);
}
},
true, // Start now
null,
cron // Context
);
}

@@ -54,3 +54,3 @@

flash('info', 'Cron created');
redirect(path_to.crons);
redirect(path_to.site(cron.site()));
}

@@ -107,4 +107,17 @@ });

compound.cronjobs[cron.id].stop();
compound.cronjobs[cron.id] = null;
}
compound.cronjobs[cron.id] = new cronjob(
cron.cron,
function() {
this.cron_id = cron.id;
site.backup(compound.socket, cron.id);
},
function() {
},
true, // Start now
null,
cron // Context
);
}

@@ -141,2 +154,5 @@

send({code: 200});
if (compound.socket) {
compound.socket.emit('refresh');
}
}

@@ -143,0 +159,0 @@ });

@@ -47,3 +47,16 @@ load('application');

this.title = 'Sites index';
Site.all(function (err, sites) {
Site.all(function (err, tmpsites) {
var sites = tmpsites;
sites.forEach(function(site, i){
sites[i].last_backup = null;
site.backups({limit: 1, order: 'started DESC'}, function(err, data){
if (!err && data && data.length > 0) {
site.last_backup = 123;
}
console.log(site);
});
})
switch (params.format) {

@@ -50,0 +63,0 @@ case "json":

@@ -16,4 +16,4 @@ <ul class="breadcrumb">

<%- form.submit('<i class="icon-ok icon-white"></i> Update cron', {class: 'btn btn-primary'}) %> or
<%- linkTo('Cancel', pathTo.cron(cron), {class: 'btn'}) %>
<%- linkTo('Cancel', pathTo.site(cron.site()), {class: 'btn'}) %>
</div>
<%- form.end() %>

@@ -32,2 +32,3 @@ <ul class="breadcrumb">

<td><%- site.url %></td>
<td>

@@ -34,0 +35,0 @@ <div class="btn-group">

@@ -50,3 +50,3 @@ <ul class="breadcrumb">

<button data-trigger="download" data-id="<%- backup.id %>" class="btn btn-mini">Download</button>
<div class="progress" style="display:none;" data-id="<%- backup.id %>" >
<div class="download progress" style="display:none;" data-id="<%- backup.id %>" >
<div class="bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">

@@ -73,2 +73,3 @@ </div>

<th>Next Backup</th>
<th>Actions</th>
</tr>

@@ -83,2 +84,8 @@ </thead>

<td><%- cron.nextbackup %></td>
<td>
<a class="btn btn-mini" href="<%- pathTo.edit_cron(cron) %>">Edit</a>
<button class="btn btn-mini btn-danger" data-format="json" data-trigger="deleteCron" data-id="<%- cron.id %>">
Delete
</button>
</td>
</tr>

@@ -98,4 +105,10 @@ <% }); %>

<%- link_to('<i class="icon-plus"></i> Add Crons', pathTo.new_cron({site_id: site.id}), {class: 'btn'}) %>
<button data-trigger="backup" data-id="<%- site.id %>" class="btn">Backup</button>
<div class="backup progress" style="display:none;" data-id="<%- site.id %>" >
<div class="bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">
</div>
</div>
or
<%- link_to('Back to index', pathTo.sites) %>
</div>

@@ -107,5 +120,10 @@

$(this).attr('disabled', 'disabled');
$('.progress', $(this).parent()).show();
$('.download.progress', $(this).parent()).show();
});
$('[data-trigger="backup"]').on('click', function(){
$(this).attr('disabled', 'disabled');
$('.backup.progress', $(this).parent()).show();
});
});
</script>
{
"name": "jbackupmanager",
"version": "0.0.3",
"version": "0.0.4",
"engines": [

@@ -5,0 +5,0 @@ "node >= 0.8.0"

@@ -10,2 +10,7 @@ jQuery(function ($) {

window.socket.on('refresh', function(){
console.log('reload');
window.location.reload(false);
})
window.socket.on('backup-step', function(data){

@@ -12,0 +17,0 @@ $('[data-id="'+data.key+'"].progress').show();

module.exports = function (compound) {
var defaultModules = [
'jugglingdb',
'co-assets-compiler',
'co-socket'
], developmentModules = [];
if ('development' === compound.app.get('env')) {
developmentModules = [
'ejs-ext',
'seedjs',
'co-generators'
]
}
if (typeof window === 'undefined') {
return defaultModules.concat(developmentModules).map(require);
} else {
return []
}
};
module.exports =
{ "development":
{ "driver": "mysql"
}
, "test":
{ "driver": "memory"
}
, "production":
{ "driver": "mysql"
}
};
{
"development": {
"driver": "mysql",
"host": "localhost",
"post": 3306,
"database": "jbackupdatabase",
"username": "root",
"password": "root"
},
"test": {
"driver": "memory"
},
"production": {
"driver": "mysql",
"host": "localhost",
"post": 3306,
"database": "jbackupmanager",
"username": "root",
"password": "root"
}
}
module.exports = function(compound) {
var express = require('express');
var app = compound.app;
app.configure(function() {
app.use(express.static(app.root + '/public', {
maxAge: 86400000
}));
app.set('jsDirectory', '/javascripts/');
app.set('cssDirectory', '/stylesheets/');
app.set('cssEngine', 'stylus');
compound.loadConfigs(__dirname);
app.use(express.bodyParser());
app.use(express.cookieParser('secret'));
app.use(express.session({
secret: 'secret'
}));
app.use(express.methodOverride());
app.use(app.router);
});
// You can configure socket.io at this point.
compound.on('socket.io', function(io) {
io.sockets.on('connection', function(socket){
var hs = socket.handshake;
socket.on('disconnect', function () {
console.log('A socket with sessionID ' + hs.sessionID
+ ' disconnected!');
// clear the socket interval to stop refreshing the session
});
var groupId;
socket.join(hs.sessionID);
compound.socket = socket;
});
});
compound.on('ready', function(compound){
var cronjob = require('cron').CronJob;
var akeeba = require('akeebabackup');
compound.cronjobs = [];
compound.folder = '/home/skullbock/nodebackups/';
compound.models.Cron.all(function(err, cronjobs) {
cronjobs.forEach(function(cron){
cron.site(function(err, site){
compound.cronjobs[cron.id] =
new cronjob(
cron.cron,
function() {
this.cron_id = cron.id;
site.backup(compound.socket, cron.id);
},
function() {
},
true, // Start now
null,
cron // Context
);
})
});
});
});
};
var express = require('express');
module.exports = function (compound) {
var app = compound.app;
app.configure('development', function () {
app.enable('watch');
app.enable('log actions');
app.enable('env info');
app.enable('force assets compilation');
app.set('translationMissing', 'display');
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
};
var express = require('express');
module.exports = function (compound) {
var app = compound.app;
app.configure('production', function () {
app.enable('quiet');
app.enable('merge javascripts');
app.enable('merge stylesheets');
app.disable('assets timestamps');
app.use(express.errorHandler());
});
};
var express = require('express');
module.exports = function (compound) {
var app = compound.app;
app.configure('test', function () {
app.enable('quiet');
app.enable('view cache');
app.enable('model cache');
app.enable('eval cache');
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
};
module.exports = function(compound) {
var app = compound.app;
compound.tools.database = function db() {
var action = process.argv[3];
switch (action) {
case 'migrate':
case 'update':
perform(action, process.exit);
break;
default:
console.log('Unknown action', action);
break;
}
};
compound.tools.database.help = {
shortcut: 'db',
usage: 'db [migrate|update]',
description: 'Migrate or update database(s)'
};
function getUniqueSchemas() {
var schemas = [];
Object.keys(compound.models).forEach(function (modelName) {
var Model = compound.models[modelName];
var schema = Model.schema;
if (!~schemas.indexOf(schema)) {
schemas.push(schema);
}
});
return schemas;
}
function perform(action, callback) {
console.log('Perform', action, 'on');
var wait = 0;
getUniqueSchemas().forEach(function (schema) {
if (schema['auto' + action]) {
console.log(' - ' + schema.name);
wait += 1;
process.nextTick(function () {
schema['auto' + action](done);
});
}
});
if (wait === 0) done(); else console.log(wait);
function done() {
if (--wait === 0) callback();
}
return true;
}
};
exports.routes = function (map) {
map.resources('crons');
map.resources('sites');
map.socket('backup', 'sites#backup');
map.socket('download', 'sites#download');
};
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Compound</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css">
<meta name="viewport" content="width=500, initial-scale=0.5">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/javascripts/rails.js"></script>
</head>
<body>
<div class="container">
<div class="page-header" style="text-align: center;">
<h1 style="text-align:left; padding-top: 35px; padding-left: 100px">Welcome to</h1>
<img src="/images/compound.png" alt="CompoundJS" />
</div>
<h6 style="text-align: center;">
<a href="/compound/environment.json" id="show-env-info-link" data-remote="true" data-jsonp="load">Information about application environment</a>
</h6>
<div id="env-info"></div>
<hr />
<div class="row">
<div class="span8 offset4">
<div class="content">
<h6>1. Start with <a href="http://compoundjs.com/docs.html#generators">generators</a></h6>
<p> This is the fastest way to create an application:</p>
<pre>compound generate crud post title content date:date published:boolean</pre>
<h6>2. Then describe a <a href="http://compoundjs.com/docs.html#routing">route</a></h6>
<p>in <code>config/routes.js</code> and remove this file (<code>public/index.html</code>)</p>
<pre>exports.routes = function (map) {
map.get('/', 'posts#index');
};</pre>
<h6>3. Design your <a href="http://compoundjs.com/docs.html#orm">database</a></h6>
<p>in <code>db/schema.js</code> and describe models in <code>app/models/*</code></p>
<h6>4. Keep your <a href="http://compoundjs.com/docs.html#controllers">controllers</a> thin!</h6>
<p>Write tests, and good luck.<br> If you have any questions feel free to ask at <a href="http://groups.google.com/group/compoundjs">CompoundJS Google Group</a> or <a href="irc://irc.freenode.net/compoundjs">#compoundjs on irc.freenode.net</a>.</p>
<p>Track CompoundJS project state on our <a href="https://trello.com/board/railwayjs/4f0a0d49128365065e008a1d">Trello board</a>, vote for features, discuss. Help us to get better!</p>
</div>
</div>
<div class="span4">
<p>
<h6>5. Links in sidebar</h6>
<ul style="padding-left: 0px;">
<li><a href="http://compoundjs.com">CompoundJS project docs</a></li>
<li><a href="http://expressjs.com">ExpressJS project homepage</a></li>
<li><a href="http://jsdoc.info/1602/jugglingdb">JugglingDB ORM API docs</a></li>
<li><a href="http://compoundjs.com/juggling.html">Try JugglingDB in your browser, docs</a></li>
</ul>
</p>
</div>
</div>
<footer>
</footer>
<script>
function load(data) {
$('#show-env-info-link').hide();
if (data.forbidden) {
return '';
}
var html = '<table class="zebra-striped">';
html += makeList('Versions', data.versions);
html += makeList('Settings', data.settings);
html += makeList('Application', data.application);
html += makeList('ENV', data.env);
html += '</table>';
$('#env-info').html(html);
}
function makeList(title, obj) {
var res = '<tr><td colspan="2"><h6>' + title + '</h6></td></tr>';
for (var i in obj) {
res += '<tr><td>' + i + '</td><td>' + toS(obj[i]) + '</td></tr>';
}
return res;
}
function toS(obj) {
if (obj instanceof Array) {
return obj.join('<br />');
} else if (typeof obj === 'object') {
var s = [];
for (var i in obj) {
s.push(i + ': ' + obj[i]);
}
return s.join(', ');
} else {
return obj;
}
}
</script>
</div>
</body>
</html>

Sorry, the diff of this file is not supported yet