Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4284fded99 | ||
|
|
4bede83ccd | ||
|
|
fe8e782e9f | ||
|
|
3eb89e5dc6 | ||
|
|
1362eb4cd9 |
No files matched your search
@@ -15,22 +15,31 @@
|
|||||||
# along with GenieACS. If not, see <http://www.gnu.org/licenses/>.
|
# along with GenieACS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
path = require 'path'
|
||||||
config = require './config'
|
config = require './config'
|
||||||
common = require './common'
|
common = require './common'
|
||||||
|
|
||||||
|
|
||||||
|
FILES = {}
|
||||||
|
getFile = (filename) ->
|
||||||
|
if filename not of FILES
|
||||||
|
FILES[filename] = require(path.resolve(config.get('CONFIG_DIR'), "custom_commands/#{filename}"))
|
||||||
|
|
||||||
|
return FILES[filename]
|
||||||
|
|
||||||
|
|
||||||
exports.execute = (deviceId, command, callback) ->
|
exports.execute = (deviceId, command, callback) ->
|
||||||
args = command.split(/\s+/)
|
args = command.split(/\s+/)
|
||||||
f = args.shift()
|
f = args.shift()
|
||||||
c = args.shift()
|
c = args.shift()
|
||||||
|
|
||||||
file = require "../config/custom_commands/#{f}"
|
file = getFile(f)
|
||||||
file[c](deviceId, args.join(' '), callback)
|
file[c](deviceId, args.join(' '), callback)
|
||||||
|
|
||||||
|
|
||||||
exports.getFileCommands = (filename) ->
|
exports.getFileCommands = (filename) ->
|
||||||
commands = []
|
commands = []
|
||||||
f = require("../config/custom_commands/#{filename}")
|
f = getFile(filename)
|
||||||
for k,v of f
|
for k,v of f
|
||||||
commands.push(k)
|
commands.push(k)
|
||||||
return commands
|
return commands
|
||||||
|
|||||||
+1
-1
@@ -185,7 +185,7 @@ inform = (currentRequest, cwmpRequest) ->
|
|||||||
deviceCustomCommands[k] = v._timestamp for k,v of device._customCommands
|
deviceCustomCommands[k] = v._timestamp for k,v of device._customCommands
|
||||||
|
|
||||||
for cmd in customCommands.getDeviceCustomCommandNames(currentRequest.session.deviceId)
|
for cmd in customCommands.getDeviceCustomCommandNames(currentRequest.session.deviceId)
|
||||||
if not (deviceCustomCommands[cmd]?._timestamp < lastBootstrap)
|
if not deviceCustomCommands[cmd]? or deviceCustomCommands[cmd] < lastBootstrap
|
||||||
# Increment timestamp by one millisecond to ensure it runs after any refresh task
|
# Increment timestamp by one millisecond to ensure it runs after any refresh task
|
||||||
_tasks.push({device: currentRequest.session.deviceId, name: 'customCommand', command: "#{cmd} init", timestamp: new Date(now.getTime() + 1)})
|
_tasks.push({device: currentRequest.session.deviceId, name: 'customCommand', command: "#{cmd} init", timestamp: new Date(now.getTime() + 1)})
|
||||||
delete deviceCustomCommands[cmd]
|
delete deviceCustomCommands[cmd]
|
||||||
|
|||||||
+8
-1
@@ -421,7 +421,14 @@ listener = (request, response) ->
|
|||||||
sort = {}
|
sort = {}
|
||||||
for k,v of s
|
for k,v of s
|
||||||
if aliases[k]?
|
if aliases[k]?
|
||||||
sort[a] = v for a in aliases[k]
|
for a in aliases[k]
|
||||||
|
if a[a.lastIndexOf('.')+1] != '_' and collectionName is 'devices'
|
||||||
|
sort["#{a}._value"] = v
|
||||||
|
else
|
||||||
|
sort[a] = v
|
||||||
|
else
|
||||||
|
if k[k.lastIndexOf('.') + 1] != '_' and collectionName is 'devices'
|
||||||
|
sort["#{k}._value"] = v
|
||||||
else
|
else
|
||||||
sort[k] = v
|
sort[k] = v
|
||||||
cur.sort(sort)
|
cur.sort(sort)
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ commitUpdates = (deviceId, deviceUpdates, commitQueue, callback) ->
|
|||||||
processBatch = (updatesBatch, cb) ->
|
processBatch = (updatesBatch, cb) ->
|
||||||
if updatesBatch.informEvents?
|
if updatesBatch.informEvents?
|
||||||
update['$set']['_lastInform'] = now
|
update['$set']['_lastInform'] = now
|
||||||
update['$set']['_lastBoot'] if '1 BOOT' in updatesBatch.informEvents
|
update['$set']['_lastBoot'] = now if '1 BOOT' in updatesBatch.informEvents
|
||||||
update['$set']['_lastBootstrap'] if '0 BOOTSTRAP' in updatesBatch.informEvents
|
update['$set']['_lastBootstrap'] = now if '0 BOOTSTRAP' in updatesBatch.informEvents
|
||||||
|
|
||||||
if updatesBatch.parameterValues?
|
if updatesBatch.parameterValues?
|
||||||
for p in updatesBatch.parameterValues
|
for p in updatesBatch.parameterValues
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "genieacs",
|
"name": "genieacs",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"description": "A blazing fast TR-069 auto configuration server (ACS) built with Node.js, Redis, and MongoDB",
|
"description": "A blazing fast TR-069 auto configuration server (ACS) built with Node.js, Redis, and MongoDB",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in new issue
Block a user