Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91f9a8f54b | ||
|
|
68b6a786bf | ||
|
|
9fde3ad5d5 | ||
|
|
3fa299cbee | ||
|
|
b8e3260e75 | ||
|
|
47f7282a27 | ||
|
|
4e57b7124a | ||
|
|
650efa9bec |
No files matched your search
@@ -84,7 +84,7 @@ connectionRequest = (deviceId, callback) ->
|
|||||||
)
|
)
|
||||||
|
|
||||||
request.on('socket', (socket) ->
|
request.on('socket', (socket) ->
|
||||||
socket.setTimeout(2000)
|
socket.setTimeout(config.get('CONNECTION_REQUEST_TIMEOUT', deviceId))
|
||||||
socket.on('timeout', () ->
|
socket.on('timeout', () ->
|
||||||
request.abort()
|
request.abort()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ options = {
|
|||||||
GET_PARAMETER_NAMES_DEPTH_THRESHOLD : {type : 'int', default : 0},
|
GET_PARAMETER_NAMES_DEPTH_THRESHOLD : {type : 'int', default : 0},
|
||||||
TASK_PARAMETERS_BATCH_SIZE : {type : 'int', default : 32},
|
TASK_PARAMETERS_BATCH_SIZE : {type : 'int', default : 32},
|
||||||
COOKIES_PATH : {type : 'string'},
|
COOKIES_PATH : {type : 'string'},
|
||||||
|
CONNECTION_REQUEST_TIMEOUT : {type : 'int', default : 2000},
|
||||||
|
|
||||||
# Libxml related configuration
|
# Libxml related configuration
|
||||||
XML_PARSE_RECOVER : {type : 'bool'},
|
XML_PARSE_RECOVER : {type : 'bool'},
|
||||||
|
|||||||
+14
-8
@@ -290,19 +290,25 @@ listener = (request, response) ->
|
|||||||
action = r[2]
|
action = r[2]
|
||||||
if not action? or action is '/'
|
if not action? or action is '/'
|
||||||
if request.method == 'DELETE'
|
if request.method == 'DELETE'
|
||||||
db.tasksCollection.remove({'_id' : taskId}, (err, removedCount) ->
|
db.tasksCollection.findOne({'_id' : taskId}, {'device' : 1}, (err, task) ->
|
||||||
if err
|
throw err if err
|
||||||
response.writeHead(500)
|
|
||||||
response.end(errorToString(err))
|
|
||||||
return
|
|
||||||
|
|
||||||
if removedCount == 0
|
if not task
|
||||||
response.writeHead(404)
|
response.writeHead(404)
|
||||||
response.end()
|
response.end()
|
||||||
return
|
return
|
||||||
|
|
||||||
response.writeHead(200)
|
deviceId = task.device
|
||||||
response.end()
|
db.tasksCollection.remove({'_id' : taskId}, (err, removedCount) ->
|
||||||
|
throw err if err
|
||||||
|
|
||||||
|
db.redisClient.del("#{deviceId}_presets_hash", (err) ->
|
||||||
|
throw err if err
|
||||||
|
|
||||||
|
response.writeHead(200)
|
||||||
|
response.end()
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
response.writeHead 405, {'Allow': 'PUT DELETE'}
|
response.writeHead 405, {'Allow': 'PUT DELETE'}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ normalizers.default = (input, normType) ->
|
|||||||
|
|
||||||
r = stringToRegexp(input)
|
r = stringToRegexp(input)
|
||||||
if r isnt false
|
if r isnt false
|
||||||
vals.push({'$regex' : r})
|
vals.push(r)
|
||||||
|
|
||||||
return vals
|
return vals
|
||||||
return input
|
return input
|
||||||
@@ -90,7 +90,7 @@ normalizers.date = (input, normType) ->
|
|||||||
normalizers.string = (input, normType) ->
|
normalizers.string = (input, normType) ->
|
||||||
if normType is 'query'
|
if normType is 'query'
|
||||||
if (m = /^\/(.*?)\/(g?i?m?y?)$/.exec(input))
|
if (m = /^\/(.*?)\/(g?i?m?y?)$/.exec(input))
|
||||||
return [{'$regex' : new RegExp(m[1], m[2])}, input]
|
return [new RegExp(m[1], m[2]), input]
|
||||||
return input
|
return input
|
||||||
|
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ normalizers.mac = (input, normType) ->
|
|||||||
if input.length == 17
|
if input.length == 17
|
||||||
return [input, input.toLowerCase()]
|
return [input, input.toLowerCase()]
|
||||||
|
|
||||||
return {'$regex' : new RegExp(input, 'i')}
|
return new RegExp(input, 'i')
|
||||||
|
|
||||||
|
|
||||||
exports.normalize = (path, value, normType) ->
|
exports.normalize = (path, value, normType) ->
|
||||||
|
|||||||
+15
-4
@@ -51,8 +51,17 @@ expandValue = (param, value) ->
|
|||||||
while i < indices.length
|
while i < indices.length
|
||||||
obj = {}
|
obj = {}
|
||||||
for i in [0...keys.length]
|
for i in [0...keys.length]
|
||||||
|
if common.typeOf(values[i][indices[i]]) is common.REGEXP_TYPE
|
||||||
|
if keys[i] == '$ne'
|
||||||
|
obj['$not'] = values[i][indices[i]]
|
||||||
|
continue
|
||||||
|
else if keys[i] == '$not' and common.typeOf(values[i][indices[i]]) isnt common.OBJECT_TYPE
|
||||||
|
# Only a regex or decoument (object) are allowed within a $not operator.
|
||||||
|
# This is needed in order to discard string from which a regex is generated.
|
||||||
|
continue
|
||||||
|
|
||||||
obj[keys[i]] = values[i][indices[i]]
|
obj[keys[i]] = values[i][indices[i]]
|
||||||
objs.push(obj)
|
objs.push(obj) if Object.keys(obj).length
|
||||||
|
|
||||||
for i in [0...indices.length]
|
for i in [0...indices.length]
|
||||||
indices[i] += 1
|
indices[i] += 1
|
||||||
@@ -95,10 +104,12 @@ expand = (query, aliases) ->
|
|||||||
else
|
else
|
||||||
conditions = permute(k, v, aliases)
|
conditions = permute(k, v, aliases)
|
||||||
if conditions.length > 1
|
if conditions.length > 1
|
||||||
if new_query['$and']?
|
new_query['$and'] ?= []
|
||||||
new_query['$and'].push({'$or' : conditions})
|
if v?['$ne']? or v?['$nin']? or v?['$not']?
|
||||||
|
for c in conditions
|
||||||
|
new_query['$and'].push(c)
|
||||||
else
|
else
|
||||||
new_query['$and'] = [{'$or' : conditions}]
|
new_query['$and'].push({'$or' : conditions})
|
||||||
else
|
else
|
||||||
common.extend(new_query, conditions[0])
|
common.extend(new_query, conditions[0])
|
||||||
|
|
||||||
|
|||||||
+31
-23
@@ -322,31 +322,39 @@ this.download = (task, methodResponse, callback) ->
|
|||||||
return
|
return
|
||||||
|
|
||||||
if methodResponse.type isnt 'DownloadResponse'
|
if methodResponse.type isnt 'DownloadResponse'
|
||||||
db.filesCollection.findOne({_id : mongodb.ObjectID(String(task.file))}, (err, file) ->
|
if task.url?
|
||||||
if not file?
|
methodRequest = {
|
||||||
callback('File not found')
|
type : 'Download',
|
||||||
return
|
fileType : task.fileType or '1 Firmware Upgrade Image',
|
||||||
else if err?
|
url : task.url,
|
||||||
callback(err)
|
username: task.username,
|
||||||
return
|
password: task.password,
|
||||||
|
successUrl : task.successUrl,
|
||||||
|
failureUrl : task.failureUrl
|
||||||
|
}
|
||||||
|
callback(null, STATUS_OK, methodRequest)
|
||||||
|
else
|
||||||
|
db.filesCollection.findOne({_id : mongodb.ObjectID(String(task.file))}, (err, file) ->
|
||||||
|
if err or not file?
|
||||||
|
return callback(err or new Error('File not found'))
|
||||||
|
|
||||||
l = {
|
l = {
|
||||||
protocol : if config.get('FS_SSL') then 'https' else 'http',
|
protocol : if config.get('FS_SSL') then 'https' else 'http',
|
||||||
hostname : config.get('FS_IP'),
|
hostname : config.get('FS_IP'),
|
||||||
port : config.get('FS_PORT'),
|
port : config.get('FS_PORT'),
|
||||||
pathname : encodeURIComponent(file.filename)
|
pathname : encodeURIComponent(file.filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
methodRequest = {
|
methodRequest = {
|
||||||
type : 'Download',
|
type : 'Download',
|
||||||
fileType : file.metadata.fileType,
|
fileType : file.metadata.fileType,
|
||||||
fileSize : file.length,
|
fileSize : file.length,
|
||||||
url : url.format(l),
|
url : url.format(l),
|
||||||
successUrl : task.successUrl,
|
successUrl : task.successUrl,
|
||||||
failureUrl : task.failureUrl
|
failureUrl : task.failureUrl
|
||||||
}
|
}
|
||||||
callback(null, STATUS_OK, methodRequest)
|
callback(null, STATUS_OK, methodRequest)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
callback(null, STATUS_COMPLETED)
|
callback(null, STATUS_COMPLETED)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "genieacs",
|
"name": "genieacs",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"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