Changeset 38950

Show
Ignore:
Timestamp:
07/01/11 23:22:30 (23 months ago)
Author:
NeoCat
Message:

Ask re-auth on DM access error

Location:
websites/twicli
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • websites/twicli/lang.js

    r38931 r38950  
    5757        'Are you sure to report $1 as spam?': ['本当に $1 をスパムとして報告しますか?','真的要举报 $1 么?'], 
    5858        'An external plugin is specified. This plugin can fully access to your account.\nAre you sure to load this?': ['外部プラグインが指定されています。このプラグインはあなたのアカウントに自由にアクセス可能になります。本当にロードしてもよろしいですか?','你欲加载外部地址上的插件。这个插件将自由访问你的帐号信息。确认加载?'], 
     59        'Cannot access to direct messages. Please re-auth twicli for DM access.': ['ダイレクトメッセージにアクセスできません。お手数ですが再度認証を行ってください。'], 
    5960        'An old HTML file is loaded. Please reload it. If the problem is not fixed, please try erasing caches.': ['古いHTMLファイルがロードされています。リロードしてみて下さい。それでも解決しない場合はキャッシュを削除してみて下さい。'] 
    6061}; 
  • websites/twicli/twicli.js

    r38946 r38950  
    432432} 
    433433 
    434 function logout() { 
    435         if (!confirm(_('Are you sure to logout? You need to re-authenticate twicli at next launch.'))) 
     434function logout(force) { 
     435        if (!force && !confirm(_('Are you sure to logout? You need to re-authenticate twicli at next launch.'))) 
    436436                return; 
    437437        callPlugins('logout'); 
     
    442442} 
    443443 
    444 function error(str) { 
     444function error(str, err) { 
     445        console.log(err); 
     446        if (err && err[0] && err[0].code == 93) { 
     447                if (confirm(_('Cannot access to direct messages. Please re-auth twicli for DM access.'))) 
     448                        logout(true); 
     449                return; 
     450        } 
    445451        if (str.indexOf('Rate limit exceeded.') == 0) { 
    446452                if (ratelimit_reset_time && new Date < ratelimit_reset_time) 
     
    933939function twDirect1(tw) { 
    934940        if (tw.error) return error(tw.error); 
     941        if (tw.errors) return error(tw.errors[0].message, tw.errors); 
    935942        direct1 = tw; 
    936943        if (direct2) 
     
    939946function twDirect2(tw) { 
    940947        if (tw.error) return error(tw.error); 
     948        if (tw.errors) return error(tw.errors[0].message, tw.errors); 
    941949        direct2 = tw; 
    942950        if (direct1) 
     
    965973function twDirectCheck(tw) { 
    966974        if (tw.error) return error(tw.error); 
     975        if (tw.errors) return error(tw.errors[0].message, tw.errors); 
    967976        if (!tw || tw.length == 0) return false; 
    968977        var id = tw[0].id_str || tw[0].id;