Skip to content
Permalink
Browse files

code generator fix

  • Loading branch information...
nick7zmail committed Jul 3, 2019
1 parent c156efb commit 2b987e6f2876679edbcfc1d6d29ebe555793db68
Showing with 9 additions and 9 deletions.
  1. +3 −3 modules/dev_broadlink/broadlink.class.php
  2. +6 −6 templates/dev_broadlink/code_gen/generator.js
@@ -2065,15 +2065,15 @@ class Cloud extends Broadlink{
protected $loginsession;
protected $userid;
protected $nickname;
protected $workdir = 'cached';
protected $workdir = 'cms' . DIRECTORY_SEPARATOR . 'cached' . DIRECTORY_SEPARATOR . 'broadlink';
protected static $file = 'bl_buckup.zip';
function __construct($nickname = "", $userid = "", $loginsession = "") {
$this->loginsession = $loginsession;
$this->userid = $userid;
$this->nickname = $nickname;
$this->workdir = ROOT.$this->workdir.DIRECTORY_SEPARATOR.'broadlink'.DIRECTORY_SEPARATOR;
$this->workdir = ROOT.$this->workdir.DIRECTORY_SEPARATOR;
if (($nickname === "") || ($userid === "") || ($loginsession === "")) {
$this->authorized = false;
} else {
@@ -2250,7 +2250,7 @@ public function GetBackup($pathname) {
file_put_contents($this->workdir.self::$file, $result["msg"]);
if (!is_dir($this->workdir)){
@mkdir(ROOT . 'cached', 0777);
@mkdir(ROOT . 'cms'. 'cached', 0777);
@mkdir($this->workdir, 0777);
}
if (file_exists($this->workdir.self::$file)) {
@@ -56,20 +56,20 @@ function generate(type){
var resWithRepeat = typePrefix + LONG_REPEAT + DATA_LENGTH + code + FOOTER;

return {
regular: hexToBase64(res),
long: hexToBase64(resWithRepeat)
regular: res,
long: resWithRepeat
}
}

function getRepeats(b64){
var hex = base64ToHex(b64).replace(/ /g,'');
var hex = b64.replace(/ /g,'');
var repeats = hex.substr(2, 2);
var decimal = parseInt(repeats, 16);
return decimal;
}

function getNewCode(b64, repeats){
var hex = base64ToHex(b64).replace(/ /g,'');
var hex = b64.replace(/ /g,'');
var start = hex.substr(0, 2);
var end = hex.substr(4);

@@ -80,7 +80,7 @@ function getNewCode(b64, repeats){
}

var res = (start + hexrepeats + end);
return hexToBase64(res);
return res;

}

@@ -108,7 +108,7 @@ function generateLivolo(remoteId, btn){
hex_out = hex_out + ('').leftJustify(pad_len,0);
//alert(hex_out);

return hexToBase64(hex_out);
return hex_out;


/*

0 comments on commit 2b987e6

Please sign in to comment.
You can’t perform that action at this time.