Xm798 / Genshin-Dailynote-Reminder

原神上班提醒小助手 | Check and push the status of the Genshin Impact resin, commissions, expeditions, home coins and transformer.
GNU General Public License v3.0
8 stars 1 forks source link

Unable to copy cookies from HoYoLAB (oversea) #2

Closed MeeiiiV closed 1 year ago

MeeiiiV commented 1 year ago

问题描述

When I try to get the cookies using the script at https://xm798.gitbook.io/genshin-dailynote-helper/configuration javascript:(()=>{_=(n)=>{for(i in(r=document.cookie.split(';'))){var a=r[i].split('=');if(a[0].trim()==n)return a[1]}};c=_('account_id')||alert('Invalid Cookie,please relogin!');c&&confirm('Copy cookies to clipboard?')&&copy(document.cookie)})(); I get the following alert: image

I assume it is due to cookies names changed to "*_v2", attaching names of the current cookies at HoYoLAB: image

运行环境

本地运行

程序版本

v2.3.1

复现流程

No response

完整日志

No response

其他补充说明

No response

Xm798 commented 1 year ago

Yes, I just checked and found that HoYoLab has completely upgraded the format of its cookies. You can use:

javascript:(()=>{_=(n)=>{for(i in(r=document.cookie.split(';'))){var a=r[i].split('=');if(a[0].trim()==n)return a[1]}};confirm('Copy cookies to clipboard?')&&copy(document.cookie)})();

to get cookies, but I'm not sure if it will still work. You can also try the cookies from https://account.hoyoverse.com/. If there are any more updates, please let me know.

MeeiiiV commented 1 year ago

I tried already with those cookies but seems like it is not working. image Btw, I set the language to "en_US" and still shows those INFOs in Chinese.

[https://account.hoyoverse.com/]() gives less cookies than HoYoLAB. image

Thank you for the fast response.

Xm798 commented 1 year ago

I think your time zone and language are not set up correctly. The reason it's in sleep mode is due to the incorrect time zone. Please check config.example.yaml for configuration.

MeeiiiV commented 1 year ago

I see now, I thought adding a "#" before "SLEEP_TIME" would disable it, I corrected it already and now it shows this: image

Xm798 commented 1 year ago

I'm sorry, it looks like there's a bug. I'll try to fix it soon.

MeeiiiV commented 1 year ago

Thank you so much! I'll be waiting for the fix.

Xm798 commented 1 year ago

I've just fixed the issue and updated the method for obtaining the "Cookie" in the documentation. Please give it another try. I don't play on the oversea server, so if there are any further issues, please let me know.

MeeiiiV commented 1 year ago

image Is this the intended behavior? I set "RESIN_THRESHOLD: 1" to get notification once I run the program but seems like it's not working.

image I assume Right Clicking in "cookie" at "Headers" tab and selecting "Copy value" is the correct way to get the cookies.

Thank you for the hard work!

Xm798 commented 1 year ago

Everything appears to be functioning normally on my end, and I'm unable to replicate the issue you're experiencing. It seems you've encountered an issue with retrieving role information from mihoyo's server. To help diagnose this, I've released a new version that includes logging capabilities for scenarios where role information can't be obtained. Could you please use your browser's incognito mode to re-login to HOYOLAB and capture the most up-to-date cookie? The cookie should look something like this:

_MHYUUID=xx; mi18nLang=xx; DEVICEFP_SEED_ID=xx; DEVICEFP_SEED_TIME=xx; cookie_token_v2=xxxx; account_mid_v2=xx; account_id_v2=xx; ltmid_v2=xx; ltuid_v2=xx; DEVICEFP=xx; ltoken_v2=xxx

Once you've configured it, run the application again. If errors persist, please provide me with the latest log for further analysis.

Additionally, I've made updates to fix the multi-language support issue. Now, the application should properly display English text if you have set en_US as your preferred language in the config file.

Lastly, it appears that you may not have set up any channels for receiving notifications. If you haven't been receiving any alerts, you might want to consult the documentation to add a notification channel, such as email or Telegram.

MeeiiiV commented 1 year ago

Thank you so much seems like the problem was the browser I was using "Cent Browser" (even Incognito Mode cookies didn't work), tried to get the cookies from MS Edge and they are working great. And yes my old cookies were looking like that too.

Nice, is a lot easier seeing all in English and the logging is a good plus as there isn't a demo of what expect of the program after run it (I was expecting it querying the info from my account and showing it there before setup the notifications).

Btw, maybe can replace "1th", "2th" with "#1", "#2"as in proper English it is 1st, 2nd, 3rd, 4th, 5th... so first 3 numbers doesn't end with "th". image