Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加框架中与getcookies扩展的通信数据标记 #572

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions web/static/coffee/har/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ define (require, exports, module) ->
window.addEventListener("message", (ev) ->
if event.origin != window.location.origin
return

cookie = ev.data
cookie_str = ""
for key, value of cookie
cookie_str += key + '=' + value + '; '
if cookie_str == ''
console.log('没有获得cookie, 您是否已经登录?')
# 排除未带特定key的postMessage
if !cookie.info
return
if cookie.info == 'cookieRaw'
for key, value of cookie
cookie_str += key + '=' + value + '; '
if cookie_str == ''
console.log('没有获得cookie, 您是否已经登录?')
return
else if cookie.info == 'get-cookieModReady'
cookie_str="get-cookie扩展已就绪"
cookie_input?.val(cookie_str)
cookie_input?.scope().$parent.var.value = cookie_str
)
Expand Down
21 changes: 14 additions & 7 deletions web/static/har/editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions web/tpl/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,21 @@ <h2 class="text-center">{{ title }}<sup id="qd_header_sup">{% if sup %}{{ versio
if (event.origin != window.location.origin) {
return ;
}

var cookie = event.data;
var cookie_str = "";
for (key in cookie) {
cookie_str += key+'='+cookie[key]+'; '
}
if (cookie_str == '') {
// alert('没有获得cookie,您是否已经登录?');
return;
var cookie_str = '';
//排除未带特定key的postMessage
if (!cookie.info){return};
//if (!cookie.info){cookie_str=="你可能在使用旧版get-cookies插件,请获取更新"};
if (cookie.info=="cookieRaw"){
for (key in cookie.data) {
cookie_str += key+'='+cookie.data[key]+'; '
}
if (cookie_str == '') {
// alert('没有获得cookie,您是否已经登录?');
return;
}
}else if(cookie.info=='get-cookieModReady'){
cookie_str="get-cookie扩展已就绪";
}
$('#input-cookie').val(cookie_str);
}, false);
Expand Down
Loading