main.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. if (typeof $dora == 'undefined') {
  2. console.error('This project runs only in Dora.js.')
  3. console.error('Please visit https://dorajs.com/ for more information.')
  4. process.exit(-1)
  5. }
  6. console.info('Congratulation, your addon runs successfully!')
  7. module.exports = {
  8. async getCookie() {
  9. var userlist = $storage.get("userlist");
  10. var go = true, cookie = "";
  11. if (userlist == null) {
  12. userlist = [];
  13. $storage.put("userlist", userlist);
  14. }
  15. if (userlist.length > 0) {
  16. userlist.forEach(f => {
  17. if (f.is_login) {
  18. go = false;
  19. cookie = f.cookie;
  20. }
  21. });
  22. if (userlist.length >= 0 && go) {
  23. userlist[0].is_login = true;
  24. cookie = userlist[0].cookie;
  25. $storage.put("userlist", userlist);
  26. }
  27. }
  28. this.cookie = cookie;
  29. },
  30. cookie: "",
  31. path: '',
  32. src_dir: '', // 源路径
  33. mid: '', // 文件id
  34. isFile: true
  35. }