123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- inapi = '/worker/sign';
- incert = '/worker/cert';
- var api_resign = function (_status) {
- var _url = +"?status=" + _status + "&site=" + oauth["site"] + "&uid=" + oauth["uid"] + "&id=" + in_id;
- if (_status < 2) {
- _url += "&ssl=" + oauth["ssl"] + "&path=" + oauth["path"] + "&ipa=" + oauth["ipa"] + "&replace=" + $("#in_replace").val() + "&suo=" + $("#in_suo").val() + "&yololib=" + oauth["yololib"] + "&newname=" + $("#in_newname").val() + "&cert=" + $("#in_cert").val() + "&charset=" + oauth["charset"] + "&name=" + oauth["name"];
- }
- $.get(oauth["api"] + inapi, oauth, function (ret) {
- if (ret.code == 1) {
- _status < 2 ? sign(0) : location.reload();
- } else {
- layer.msg(ret.msg, 3, 8);
- }
- }, 'json');
- };
- var get_cert_list = function () {
- $.get(oauth["api"] + incert, oauth,
- function (ret) {
- if (ret.msg) {
- layer.msg(ret.msg, 3, 8);
- }
- if (ret.data && ret.data.list.length) {
- $("#in_cert").html('');
- $.each(ret.data.list, function (k, v) {
- $("#in_cert").append('<option value="' + v + '">' + v + '</option>');
- });
- } else {
- $("#in_cert").html('没有可用证书');
- }
- }, 'json');
- };
- function reset_sign_confirm() {
- $.layer({
- shade: [0],
- area: ["auto", "auto"],
- dialog: {
- msg: "确定要重置签名吗?",
- btns: 2,
- type: 4,
- btn: ["确定", "取消"],
- yes: function () {
- reset_sign();
- },
- no: function () {
- layer.msg("已取消重置", 1, 0);
- }
- }
- });
- }
- function reset_sign() {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", in_path + "index/ajax_sign/reset?aid=" + in_id, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- if (xhr.responseText == -1) {
- layer.msg("请先登录后再操作!", 3, 11);
- } else if (xhr.responseText == -2) {
- layer.msg("应用不存在或已被删除!", 3, 11);
- } else if (xhr.responseText == -3) {
- layer.msg("您不能重置别人的应用!", 3, 8);
- } else if (xhr.responseText == -4) {
- layer.msg("该应用未在进行签名!", 3, 8);
- } else {
- location.reload();
- }
- } else {
- layer.msg("通讯异常,请检查网络设置!", 3, 3);
- }
- }
- };
- xhr.send(null);
- }
- function sign_confirm() {
- $.layer({
- shade: [0],
- area: ["auto", "auto"],
- dialog: {
- //msg: '<font color="#000fff">签名将会去除下列文件名注入的签名锁 <br>功能性动态库请勿使用下列文件名注入<br>否则您注入的动态库将失效!<br> sign.data <br> sign.dylib <br> embedded.dylib<br> embedded.png <br> XXGamePlugin <br>如已注入以上名称的动态库请取消签名 <br>并修改功能文件注入名称后重新上传ipa <br>再重新签名!<br><br>确定要开始签名吗?</font>',
- msg: '确定要开始签名吗?',
- btns: 2,
- type: 4,
- btn: ["确定", "取消"],
- yes: function () {
- $("#in_cert").val() == "" ? layer.msg("请选择企业证书", 1, 0) : sign(1);
- },
- no: function () {
- layer.msg("已取消签名", 1, 0);
- }
- }
- });
- }
- function sign(_check) {
- if (remote > 0) {
- //layer.msg("不支持云存储签名!", 3, 8);
- //return false;
- }
- var cert = $("#cert_" + $("#in_cert").val()).text();
- var xhr = new XMLHttpRequest();
- xhr.open("GET", in_path + "index/ajax_sign/sign?check=" + _check + "&cert=" + encodeURIComponent(cert) + "&aid=" + in_id, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- if (xhr.responseText == -1) {
- layer.msg("请先登录后再操作!", 3, 11);
- } else if (xhr.responseText == -2) {
- layer.msg("应用不存在或已被删除!", 3, 11);
- } else if (xhr.responseText == -3) {
- layer.msg("您不能签名别人的应用!", 3, 8);
- } else if (xhr.responseText == -4) {
- layer.msg("不能签名Android应用!", 3, 8);
- } else if (xhr.responseText == -5) {
- layer.msg("该应用未开通企业签名!", 3, 8);
- } else if (xhr.responseText == -6) {
- layer.msg("该应用补签名额不足!", 3, 8);
- } else if (xhr.responseText == -7) {
- layer.msg("该应用正在进行签名!", 3, 8);
- } else {
- _check > 0 ? api_resign(1) : location.reload();
- }
- } else {
- layer.msg("通讯异常,请检查网络设置!", 3, 3);
- }
- }
- };
- xhr.send(null);
- }
- function listen() {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", in_path + "index/ajax_sign/listen?aid=" + in_id, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4 && xhr.status == 200) {
- var data = eval("(" + xhr.responseText + ")");
- if (xhr.responseText == -1) {
- $("#_listen").text("请先登录后再操作!");
- } else if (data["status"] == 2) {
- api_resign(2);
- } else if (data["step"] == "download") {
- $("#_listen").text("正在解析文件,请稍等..." + data["percent"] + "%");
- } else if (data["step"] == "sign") {
- $("#_listen").text("正在进行签名,请稍等..." + data["percent"] + "%");
- } else if (data["step"] == "upload") {
- $("#_listen").text("正在进行回传,请稍等..." + data["percent"] + "%");
- }
- }
- };
- xhr.send(null);
- }
- function download() {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", in_path + "index/ajax_sign/download?aid=" + in_id, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- if (xhr.responseText == -1) {
- layer.msg("请先登录后再操作!", 3, 11);
- } else if (xhr.responseText == -2) {
- layer.msg("应用不存在或已被删除!", 3, 11);
- } else if (xhr.responseText == -3) {
- layer.msg("您不能下载别人的应用!", 3, 8);
- } else if (xhr.responseText == -4) {
- layer.msg("该应用暂未完成签名!", 3, 8);
- } else {
- location.href = xhr.responseText;
- }
- } else {
- layer.msg("通讯异常,请检查网络设置!", 3, 3);
- }
- }
- };
- xhr.send(null);
- }
- function purchase(_key) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", in_path + "index/ajax_sign/purchase?aid=" + in_id + "&key=" + _key, true);
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- if (xhr.responseText == -1) {
- layer.msg("请先登录后再操作!", 3, 11);
- } else if (xhr.responseText == -2) {
- layer.msg("应用不存在或已被删除!", 3, 11);
- } else if (xhr.responseText == -3) {
- layer.msg("密钥不正确或已被使用!", 3, 8);
- } else if (xhr.responseText == 1) {
- location.reload();
- }
- } else {
- layer.msg("通讯异常,请检查网络设置!", 3, 3);
- }
- }
- };
- xhr.send(null);
- }
- function tishi() {
- alert('签名开始后请勿切换到其他页面或刷新\n否则可能签名失败,请耐心等待!');
- }
- function tishi1() {
- alert('签名将会去除下列文件名注入的签名锁 \n功能性动态库请勿使用下列文件名注入\n否则您注入的动态库将失效!\n sign.data \n sign.dylib \n embedded.dylib\n embedded.png \n XXGamePlugin \n如已注入以上名称的动态库请取消签名 \n并修改功能文件注入名称后重新上传ipa \n再重新签名!');
- }
- function change(type) {
- var inre = $("#in_replace").val();
- if (type == 1) {
- $('#check').html('<input type="text" class="col-sm-9 linkform-control" value="*.*|*" id="in_replace" style="display:none;" readonly="true">');
- }
- if (inre == '*.*|*') {
- $('#check').html('<input type="text" class="col-sm-9 link" placeholder="指定特殊签名文件,默认留空!多文件以 | 隔开" id="in_replace"><br><br>');
- }
- }
|