This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
23,533 additions
and
606 deletions.
There are no files selected for viewing
Binary file renamed
BIN
+55.7 MB
build/sarcat-0.3.0-os.linux.x86_64.tar.gz → build/sarcat-0.4.0-os.linux.x86_64.tar.gz
100755 → 100644
Binary file not shown.
Binary file renamed
BIN
+60.6 MB
build/sarcat-0.3.0-os.osx.x86_64.tar.gz → build/sarcat-0.4.0-os.osx.x86_64.tar.gz
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,119 @@ | ||
(function(){Meteor.startup(function () { | ||
(function(){(function() { | ||
Meteor.startup(function() { | ||
|
||
|
||
|
||
/* | ||
var environment = process.env.METEOR_ENV || "development"; | ||
var settings = JSON.parse(process.env.METEOR_SETTINGS); | ||
if (environment === "production") { | ||
Meteor.settings = settings.production; | ||
} else if (environment === "staging") { | ||
Meteor.settings = settings.staging; | ||
} else { | ||
Meteor.settings = settings.development; | ||
} | ||
console.log("Using [ " + environment + " ] Meteor.settings"); | ||
*/ | ||
console.log('starting sarcat'); | ||
//console.log(process.env.METEOR_SETTINGS); | ||
//var METEOR_SETTINGS = JSON.parse(process.env.METEOR_SETTINGS); | ||
config = Config.findOne(); | ||
if (!config) { | ||
console.log('config:false'); | ||
var makeEncryptionID = function () { | ||
var text = ''; | ||
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
for (var i = 0; i < 23; i++) | ||
text += possible.charAt(Math.floor(Math.random() * possible.length)); | ||
return text; | ||
}; | ||
console.log('saving settings.config to mongodb'); | ||
//Meteor.settings.config.encryptionKey = encryptionKey; | ||
encryptionKey = makeEncryptionID(); | ||
Config.insert({ | ||
encryptionKey: encryptionKey | ||
}); | ||
console.log('starting sarcat'); | ||
//console.log(process.env.METEOR_SETTINGS); | ||
//var METEOR_SETTINGS = JSON.parse(process.env.METEOR_SETTINGS); | ||
config = Config.findOne(); | ||
} | ||
|
||
|
||
|
||
|
||
if (!Meteor.users.find().count()) { | ||
console.log('Creating default admin user.'); | ||
var admin = Accounts.createUser({ | ||
'email': 'admin@sarcat', | ||
'password': 'admin', | ||
'username': 'Default Admin' | ||
}); | ||
Roles.addUsersToRoles(admin, ['admin']); | ||
Config.update(config._id, { | ||
$set: { | ||
initSetup: true | ||
} | ||
}); | ||
} | ||
|
||
|
||
|
||
|
||
var publicSettings = (Meteor.settings && Meteor.settings.public) ? Meteor.settings.public : config; | ||
_.each(publicSettings, function (d, e) { | ||
if (!_.isEqual(config[e], publicSettings[e])) { | ||
console.log('Updating config: ' + e); | ||
console.log(config[e] + ' ---> ' + publicSettings[e]); | ||
var obj = {}; | ||
obj[e] = publicSettings[e]; | ||
Config.update(config._id, { | ||
$set: obj | ||
if (!config) { | ||
console.log('config:false'); | ||
var makeEncryptionID = function() { | ||
var text = ''; | ||
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
for (var i = 0; i < 23; i++) | ||
text += possible.charAt(Math.floor(Math.random() * possible.length)); | ||
return text; | ||
}; | ||
console.log('saving settings.config to mongodb'); | ||
//Meteor.settings.config.encryptionKey = encryptionKey; | ||
encryptionKey = makeEncryptionID(); | ||
Config.insert({ | ||
encryptionKey: encryptionKey | ||
}); | ||
config = Config.findOne(); | ||
} | ||
}); | ||
/*if (!_.isEqual(config.layers, publicSettings.layers)) { | ||
console.log('Adding new Map Layers'); | ||
Config.update(config | ||
._id, { | ||
if (!Meteor.users.find().count()) { | ||
console.log('Creating default admin user.'); | ||
var admin = Accounts.createUser({ | ||
'email': 'admin@sarcat', | ||
'password': 'admin', | ||
'username': 'Default Admin' | ||
}); | ||
Roles.addUsersToRoles(admin, ['admin']); | ||
Config.update(config._id, { | ||
$set: { | ||
layers: publicSettings.layers | ||
initSetup: true | ||
} | ||
}); | ||
} | ||
var publicSettings = (Meteor.settings && Meteor.settings.public) ? Meteor.settings.public : config; | ||
_.each(publicSettings, function(d, e) { | ||
if (!_.isEqual(config[e], publicSettings[e])) { | ||
console.log('Updating config: ' + e); | ||
console.log(config[e] + ' ---> ' + publicSettings[e]); | ||
var obj = {}; | ||
obj[e] = publicSettings[e]; | ||
Config.update(config._id, { | ||
$set: obj | ||
}); | ||
} | ||
); | ||
} | ||
if (!_.isEqual(config.sarcatServer, publicSettings.sarcatServer)) { | ||
console.log('New sarcatServer'); | ||
Config.update(config | ||
._id, { | ||
$set: { | ||
sarcatServer: publicSettings.sarcatServer | ||
}); | ||
/*if (!_.isEqual(config.layers, publicSettings.layers)) { | ||
console.log('Adding new Map Layers'); | ||
Config.update(config | ||
._id, { | ||
$set: { | ||
layers: publicSettings.layers | ||
} | ||
} | ||
} | ||
); | ||
}*/ | ||
//Meteor.settings.public.layers = config.layers; | ||
Accounts.config({ | ||
loginExpirationInDays: null | ||
}); | ||
var dir = process.env.sarcatDir || process.env.PWD; | ||
var fs = Npm.require('fs'); | ||
var path = Npm.require('path'); | ||
var dir = process.env.PWD; | ||
var sarcatDir = path.join(dir, 'public/uploads'); | ||
if (process.env.sarcatDir) { | ||
dir = process.env.sarcatDir; | ||
sarcatDir = path.join(dir, 'app', 'programs', 'web.browser', 'app', 'uploads') | ||
} | ||
UploadServer.init({ | ||
tmpDir: path.join(sarcatDir, 'tmp'), | ||
uploadDir: path.join(sarcatDir, '/'), | ||
//tmpDir: dir + '/app/programs/web.browser/app/uploads/tmp', | ||
//uploadDir: dir + '/app/programs/web.browser/app/uploads/', | ||
getDirectory: function (fileInfo, formData) { | ||
if (formData._id) { | ||
return '/records/' + formData._id; | ||
} | ||
if (formData.type === 'logo') { | ||
return '/logo'; | ||
} | ||
}, | ||
cacheTime: 100, | ||
}); | ||
WebApp.connectHandlers.use(function (req, res, next) { | ||
var re = /^\/uploads\/(.*)$/.exec(req.url); | ||
if (re !== null) { | ||
var filePath = path.join(sarcatDir, re[1]); | ||
//var filePath = dir + '/app/programs/web.browser/app/uploads/' + re[1]; | ||
var data = fs.readFileSync(filePath, data); | ||
res.writeHead(200, { | ||
'Content-Type': 'image' | ||
}); | ||
res.write(data); | ||
res.end(); | ||
} else { | ||
next(); | ||
); | ||
} | ||
if (!_.isEqual(config.sarcatServer, publicSettings.sarcatServer)) { | ||
console.log('New sarcatServer'); | ||
Config.update(config | ||
._id, { | ||
$set: { | ||
sarcatServer: publicSettings.sarcatServer | ||
} | ||
} | ||
); | ||
}*/ | ||
//Meteor.settings.public.layers = config.layers; | ||
Accounts.config({ | ||
loginExpirationInDays: null | ||
}); | ||
//var dir = process.env.sarcatStorage || process.env.PWD; | ||
var fs = Npm.require('fs'); | ||
var path = Npm.require('path'); | ||
var dir = process.env.sarcatStorage ? process.env.sarcatStorage : process.env.PWD; | ||
var sarcatUploads = path.join(dir, 'public', 'uploads'); | ||
/*if (process.env.sarcatStorage) { | ||
dir = process.env.sarcatDir; | ||
sarcatDir = path.join(dir, 'app', 'programs', 'web.browser', 'app', 'uploads') | ||
}*/ | ||
UploadServer.init({ | ||
tmpDir: path.join(sarcatUploads, 'tmp'), | ||
uploadDir: path.join(sarcatUploads, '/'), | ||
getDirectory: function(fileInfo, formData) { | ||
if (formData._id) { | ||
return '/records/' + formData._id; | ||
} | ||
if (formData.type === 'logo') { | ||
return '/logo'; | ||
} | ||
}, | ||
cacheTime: 100, | ||
}); | ||
|
||
WebApp.connectHandlers.use(function(req, res, next) { | ||
var re = /^\/uploads\/(.*)$/.exec(req.url); | ||
if (re !== null) { | ||
var filePath = path.join(sarcatUploads, re[1]); | ||
//var filePath = dir + '/app/programs/web.browser/app/uploads/' + re[1]; | ||
var data = fs.readFileSync(filePath, data); | ||
/*res.writeHead(200, { | ||
'Content-Type': 'image' | ||
});*/ | ||
res.write(data); | ||
res.end(); | ||
} else { | ||
next(); | ||
} | ||
}); | ||
console.log(dir); | ||
console.log('sarcat running at: ' + process.env.ROOT_URL + ':' + process.env.PORT) | ||
}); | ||
console.log(dir); | ||
console.log('sarcat running at: ' + process.env.ROOT_URL + ':' + process.env.PORT) | ||
}); | ||
})(); | ||
|
||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.