Merge branch 'master' of github.com:strawmanbobi/irext
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,6 +7,8 @@ src/ir_decoder/libs
|
||||
src/ir_decoder/obj
|
||||
src/ir_encoder/source
|
||||
src/ir_decoder/cmake-build-debug
|
||||
src/ir_decoder/libs
|
||||
src/ir_decoder/obj
|
||||
files/
|
||||
files/*
|
||||
.DS_Store
|
||||
|
||||
@@ -191,7 +191,7 @@ JNIEXPORT jobject JNICALL Java_net_irext_remote_service_DecodeService_irdaACGetT
|
||||
|
||||
temperature_range = (*env)->NewObject(env, temperature_range_class, temperature_range_mid);
|
||||
|
||||
get_temperature_range((UINT8)ac_mode, (UINT8*)&tempMin, (UINT8*)&tempMax);
|
||||
get_temperature_range((UINT8)ac_mode, (INT8*)&tempMin, (INT8*)&tempMax);
|
||||
|
||||
(*env)->SetIntField(env, temperature_range, min_temp_fid, tempMin);
|
||||
(*env)->SetIntField(env, temperature_range, max_temp_fid, tempMax);
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
require('../mini_poem/configuration/constants');
|
||||
var Cache = require('../mini_poem/cache/redis.js');
|
||||
var logger = require('../mini_poem/logging/logger4js').helper;
|
||||
var Enums = require('../constants/enums');
|
||||
var ErrorCode = require('../constants/error_code');
|
||||
|
||||
var enums = new Enums();
|
||||
var errorCode = new ErrorCode();
|
||||
|
||||
var logger = require('../mini_poem/logging/logger4js').helper;
|
||||
|
||||
var AdminAuth = function(_cacheHost, _cachePort, _cacheAdmin, _cachePassword) {
|
||||
this.cache = new Cache(_cacheHost, _cachePort, _cacheAdmin, _cachePassword);
|
||||
|
||||
@@ -44,28 +44,11 @@ function Enums() {
|
||||
this.STAT_TYPE_REMOTE_BY_CITY = 4;
|
||||
this.STAT_TYPE_UPDATE_RECORD = 5;
|
||||
|
||||
this.BLE_REMOTE_INDEX_KEY_MAP_POWER_OFF = 0;
|
||||
this.BLE_REMOTE_INDEX_KEY_MAP_POWER_ON = 1;
|
||||
|
||||
this.JPUSH_DEVICE_TYPE_IOS = 0;
|
||||
this.JPUSH_DEVICE_TYPE_ANDROID = 1;
|
||||
this.JPUSH_DEVICE_TYPE_BOTH = 2;
|
||||
|
||||
this.JPUSH_DEST_TYPE_BROADCAST = 0;
|
||||
this.JPUSH_DEST_TYPE_PEER = 1;
|
||||
this.JPUSH_DEST_TYPE_GROUP = 2;
|
||||
|
||||
this.JPUSH_PUSH_TYPE_MESSAGE = 0;
|
||||
this.JPUSH_PUSH_TYPE_NOTIFICATION = 1;
|
||||
|
||||
this.JPUSH_FROM_PEER_CONSOLE = 0;
|
||||
this.JPUSH_FROM_PEER_DEVICE = 1;
|
||||
|
||||
this.PROTOCOL_TYPE_G1 = 0;
|
||||
this.PROTOCOL_TYPE_G2_QUATERNARY = 1;
|
||||
this.PROTOCOL_TYPE_G2_HEXDECIMAL = 2;
|
||||
|
||||
this.ADMIN_TYPE_UCON = 1;
|
||||
this.ADMIN_TYPE_IREXT = 1;
|
||||
this.ADMIN_TYPE_EXTERNAL = 2;
|
||||
}
|
||||
|
||||
|
||||
BIN
src/web_console/data/temp/rc_extension.tar.gz
Normal file
BIN
src/web_console/data/temp/rc_extension.tar.gz
Normal file
Binary file not shown.
@@ -12,9 +12,10 @@ var methodOverride = require('method-override');
|
||||
// global inclusion
|
||||
require('./mini_poem/configuration/constants');
|
||||
var System = require('./mini_poem/utils/system_utils');
|
||||
var systemConfig = require('./configuration/system_configs');
|
||||
var dbConn = require('./mini_poem/db/mysql/mysql_connection');
|
||||
|
||||
// local inclusion
|
||||
var systemConfig = require('./configuration/system_configs');
|
||||
var Enums = require('./constants/enums');
|
||||
var ErrorCode = require('./constants/error_code');
|
||||
var enums = new Enums();
|
||||
@@ -35,7 +36,6 @@ app.use("/", express.static(__dirname + '/web/'));
|
||||
systemConfig.setupEnvironment();
|
||||
serverListenPort = LISTEN_PORT;
|
||||
|
||||
var dbConn = require('./mini_poem/db/mysql/mysql_connection');
|
||||
|
||||
console.log("initializing MySQL connection to : " + MYSQL_DB_SERVER_ADDRESS + ":" + MYSQL_DB_NAME);
|
||||
dbConn.setMySQLParameter(MYSQL_DB_SERVER_ADDRESS, MYSQL_DB_NAME, MYSQL_DB_USER, MYSQL_DB_PASSWORD);
|
||||
@@ -80,7 +80,6 @@ function tokenValidation (req, res, next) {
|
||||
// request of content type of multipart/form-data would be validated inside each service
|
||||
next();
|
||||
} else {
|
||||
console.log("adminID = " + adminID + ", token = " + token);
|
||||
certificateLogic.verifyTokenWorkUnit(adminID, token, function(validateTokenErr) {
|
||||
if(errorCode.SUCCESS.code != validateTokenErr.code) {
|
||||
var fakeResponse = {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
var app = require('../irext_console.js');
|
||||
var intService = require('../services/internal_service.js');
|
||||
var intService = require('../services/code_manage_service.js');
|
||||
|
||||
app.post('/irext/int/list_provinces', intService.listProvinces);
|
||||
app.post('/irext/int/list_cities', intService.listCities);
|
||||
@@ -29,4 +29,5 @@ app.post('/irext/int/create_protocol', intService.createProtocol);
|
||||
|
||||
app.get('/irext/int/list_remote_indexes', intService.listRemoteIndexes);
|
||||
app.get('/irext/int/search_remote_indexes', intService.searchRemoteIndexes);
|
||||
|
||||
app.get('/irext/int/download_remote_index', intService.downloadRemoteIndex);
|
||||
@@ -6,6 +6,6 @@
|
||||
var server = require('../irext_console.js');
|
||||
|
||||
require('./navigation_routes.js');
|
||||
require('./internal_routes.js');
|
||||
require('./code_manage_routes.js');
|
||||
require('./certificate_routes.js');
|
||||
require('./stat_routes.js');
|
||||
|
||||
@@ -19,7 +19,7 @@ var CityResponse = require('../response/city_response.js');
|
||||
var OperatorResponse = require('../response/operator_response.js');
|
||||
var RemoteIndexResponse = require('../response/remote_index_response.js');
|
||||
|
||||
var internalLogic = require('../work_unit/internal_logic.js');
|
||||
var internalLogic = require('../work_unit/code_manage_logic.js');
|
||||
|
||||
var Enums = require('../constants/enums');
|
||||
var ErrorCode = require('../constants/error_code');
|
||||
@@ -379,8 +379,10 @@ exports.fallbackRemoteIndex = function (req, res) {
|
||||
* return : ServiceResponse
|
||||
*/
|
||||
exports.publishRemoteIndex = function (req, res) {
|
||||
var adminID = req.body.admin_id;
|
||||
|
||||
var serviceResponse = new ServiceResponse();
|
||||
internalLogic.publishRemoteIndexWorkUnit(function (publishRemoteErr) {
|
||||
internalLogic.publishRemoteIndexWorkUnit(adminID, function (publishRemoteErr) {
|
||||
serviceResponse.status = publishRemoteErr;
|
||||
res.send(serviceResponse);
|
||||
res.end();
|
||||
@@ -410,8 +412,10 @@ exports.createBrand = function (req, res) {
|
||||
* return : Service response
|
||||
*/
|
||||
exports.publishBrands = function (req, res) {
|
||||
var adminID = req.body.admin_id;
|
||||
|
||||
var serviceResponse = new ServiceResponse();
|
||||
internalLogic.publishBrandsWorkUnit(function (publishBrandsErr) {
|
||||
internalLogic.publishBrandsWorkUnit(adminID, function (publishBrandsErr) {
|
||||
serviceResponse.status = publishBrandsErr;
|
||||
res.send(serviceResponse);
|
||||
res.end();
|
||||
@@ -7,8 +7,6 @@
|
||||
var constants = require('../mini_poem/configuration/constants');
|
||||
var formidable = require('formidable');
|
||||
|
||||
// local inclusion
|
||||
var logger = require('../mini_poem/logging/logger4js').helper;
|
||||
|
||||
/*
|
||||
* function : Navigation to certain URL
|
||||
|
||||
@@ -85,9 +85,11 @@
|
||||
<span class="glyphicon glyphicon-download" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
</button>
|
||||
</div>
|
||||
<!--
|
||||
<button id="publish_button" class="btn btn-normal btn-success" onclick="onPublishRemote();" style="font-size: 14px;">
|
||||
<span class="glyphicon glyphicon-send" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
<span class="glyphicon glyphicon-cloud" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
</button>
|
||||
-->
|
||||
<button id="search_bin_button" class="btn btn-normal btn-default" onclick="onSearchRemote();" style="font-size: 14px;">
|
||||
<span class="glyphicon glyphicon-search" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
</button>
|
||||
@@ -95,9 +97,6 @@
|
||||
<div id = "remote_table_container" style="width: 100%">
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<p>Strawmanbobi, 2016</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<!-- dialogs -->
|
||||
|
||||
@@ -37,13 +37,10 @@ var adminAuth = new AdminAuth(REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, null);
|
||||
// relative XML file path
|
||||
var PROTOCOL_PATH = "protocol";
|
||||
|
||||
var REQUEST_APP_KEY = "d6119900556c4c1e629fd92d";
|
||||
var REQUEST_APP_TOKEN = "fcac5496cba7a12b3bae34abf061f526";
|
||||
|
||||
var PUBLISH_BRAND_SERVICE = "/irext/remote/publish_brands";
|
||||
var UPLOAD_BINARY_SERVICE = "/irext/remote/upload_binary";
|
||||
var PUBLISH_REMOTE_INDEX_SERVICE = "/irext/remote/publish_remote_indexes";
|
||||
var DELETE_REMOTE_INDEX_SERVICE = "/irext/remote/delete_remote_index";
|
||||
var publishBrandService = "/irext/int/publish_brands";
|
||||
var uploadBinaryService = "/irext/int/upload_binary";
|
||||
var publishRemoteIndexService = "/int/remote/publish_remote_indexes";
|
||||
var deleteRemoteIndexService = "/irext/int/delete_remote_index";
|
||||
|
||||
exports.listCategoriesWorkUnit = function (from, count, callback) {
|
||||
var conditions = {
|
||||
@@ -535,9 +532,6 @@ exports.createRemoteIndexWorkUnit = function(remoteIndex, filePath, contentType,
|
||||
};
|
||||
|
||||
exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) {
|
||||
// delete remote information from release server first
|
||||
var queryParams = new Map();
|
||||
|
||||
var key = "admin_name_" + adminID;
|
||||
adminAuth.getAuthInfo(key, function(getAdminAuthErr, result) {
|
||||
if (errorCode.SUCCESS.code == getAdminAuthErr.code && null != result) {
|
||||
@@ -546,31 +540,32 @@ exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) {
|
||||
callback(errorCode.FAILED);
|
||||
return;
|
||||
}
|
||||
key = "admin_" + adminID;
|
||||
adminAuth.getAuthInfo(key, function(getAdminAuthErr, result) {
|
||||
if (errorCode.SUCCESS.code == getAdminAuthErr.code && null != result) {
|
||||
remoteIndex.admin_id = adminID;
|
||||
remoteIndex.token = result;
|
||||
var queryParams = new Map();
|
||||
var requestSender =
|
||||
new RequestSender(EXTERNAL_SERVER_ADDRESS,
|
||||
EXTERNAL_SERVER_PORT,
|
||||
deleteRemoteIndexService,
|
||||
queryParams);
|
||||
|
||||
remoteIndex.admin_id = adminID;
|
||||
var requestSender =
|
||||
new RequestSender(EXTERNAL_SERVER_ADDRESS,
|
||||
EXTERNAL_SERVER_PORT,
|
||||
DELETE_REMOTE_INDEX_SERVICE,
|
||||
queryParams);
|
||||
|
||||
requestSender.sendPostRequest(remoteIndex,
|
||||
function(deleteRemoteIndexesRequestErr, deleteRemoteIndexesResponse) {
|
||||
/*
|
||||
if(errorCode.SUCCESS.code == deleteRemoteIndexesRequestErr &&
|
||||
JSON.parse(deleteRemoteIndexesResponse).status.code == errorCode.SUCCESS.code) {
|
||||
RemoteIndex.deleteRemoteIndex(remoteIndex.id, function(deleteRemoteIndexErr) {
|
||||
callback(deleteRemoteIndexErr);
|
||||
});
|
||||
} else {
|
||||
logger.error("failed to delete remote index from main server");
|
||||
callback(errorCode.FAILED);
|
||||
}
|
||||
*/
|
||||
// perform delete action accordingly despite the result of remote deletion
|
||||
RemoteIndex.deleteRemoteIndex(remoteIndex.id, function(deleteRemoteIndexErr) {
|
||||
callback(deleteRemoteIndexErr);
|
||||
});
|
||||
requestSender.sendPostRequest(remoteIndex,
|
||||
function(deleteRemoteIndexesRequestErr, deleteRemoteIndexesResponse) {
|
||||
// perform delete action accordingly despite the result of remote deletion
|
||||
logger.info(deleteRemoteIndexesRequestErr);
|
||||
/*
|
||||
RemoteIndex.deleteRemoteIndex(remoteIndex.id, function(deleteRemoteIndexErr) {
|
||||
callback(deleteRemoteIndexErr);
|
||||
});
|
||||
*/
|
||||
callback(errorCode.SUCCESS);
|
||||
});
|
||||
} else {
|
||||
callback(errorCode.FAILED);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(errorCode.FAILED);
|
||||
@@ -668,7 +663,7 @@ exports.publishRemoteIndexWorkUnit = function (callback) {
|
||||
var requestSender =
|
||||
new RequestSender(PRIMARY_SERVER_ADDRESS,
|
||||
PRIMARY_SERVER_PORT,
|
||||
UPLOAD_BINARY_SERVICE,
|
||||
uploadBinaryService,
|
||||
queryParams);
|
||||
var options = {
|
||||
https: false
|
||||
@@ -711,7 +706,7 @@ exports.publishRemoteIndexWorkUnit = function (callback) {
|
||||
var requestSender =
|
||||
new RequestSender(PRIMARY_SERVER_ADDRESS,
|
||||
PRIMARY_SERVER_PORT,
|
||||
PUBLISH_REMOTE_INDEX_SERVICE,
|
||||
publishRemoteIndexService,
|
||||
queryParams);
|
||||
|
||||
requestSender.sendPostRequest(remoteIndexes,
|
||||
@@ -787,7 +782,7 @@ exports.publishBrandsWorkUnit = function (callback) {
|
||||
queryParams.put("app_token", REQUEST_APP_TOKEN);
|
||||
|
||||
var requestSender =
|
||||
new RequestSender(PRIMARY_SERVER_ADDRESS, PRIMARY_SERVER_PORT, PUBLISH_BRAND_SERVICE, queryParams);
|
||||
new RequestSender(PRIMARY_SERVER_ADDRESS, PRIMARY_SERVER_PORT, publishBrandService, queryParams);
|
||||
|
||||
requestSender.sendPostRequest(brands, function(publishBrandRequestErr, publishBrandsResponse) {
|
||||
if(errorCode.SUCCESS.code == publishBrandRequestErr &&
|
||||
Reference in New Issue
Block a user