Giter VIP home page Giter VIP logo

soulsign-chrome's Introduction

功能

自动签到,每天只要打开浏览器就可以自动签到,不用填写账号密码,不用手动抓取cookie,只需要 添加脚本+登录账号

使用方法

  1. 手动安装: 点击下载插件,拖动到扩展程序中
  2. chrome网上应用店安装

firefox 安装

安装脚本

  1. 最简单的方法,点击插件图标->任务管理->脚本推荐->挑选安装
  2. 第三方或者自用脚本安装方法, 点击插件图标->任务管理->添加脚本->上传脚本文件/粘贴脚本代码/拖拽脚本文件/粘贴脚本链接

更新:

20181207: 支持用户填写参数,用于用户填写账号密码进行自动登录的场景。使用方法参考 public/demos/m.jd.js, 需要版本1.0.4+ 示例 20190326: 支持引用外部js,支持获取指定网页的cookie 示例/public/demo/xiami.js
20190428: 支持域名模糊匹配, *.baidu.com 将匹配 xxoo.baidu.com 或 www.baidu.com 但不能匹配 baidu.com
20191205: 代码重构,清理了一些逻辑,将任务管理等操作统一到了后端,保证数据一至性;增加导入导出功能;增强脚本安全性,新增@grant用于权限申请
20191208: 增加了返利捐赠开关, 访问https://www.jd.com/时将跳转到作者的返利链接
20191218: 优化代码结构,支持脚本导出/导入,增加脚本网站

计划:

  1. 低版本支持(自带babel) 无明显需求,所以放弃
  2. 脚本更新(手动/自动) ✅
  3. 脚本发布站点

脚本开发

示例:

// ==UserScript==
// @name              v2ex签到
// @namespace         https://github.com/inu1255/soulsign-chrome
// @version           1.0.0
// @author            inu1255
// @loginURL          https://www.v2ex.com/signin
// @expire            900e3
// @domain            www.v2ex.com
// ==/UserScript==

/**
 * 签到接口,可以使用axios库发起请求,请求url域名必须通过@domain声明
 * throw 签到失败并抛出失败原因
 * return 签到成功并返回成功信息
 */
exports.run = async function() {
    var ret = await axios.get('https://www.v2ex.com/mission/daily');
    if (ret.status != 200) throw '需要登录';
    if (/每日登录奖励已领取/.test(ret.data)) return '已领取';
    let m = /redeem\?once=(.*?)'/.exec(ret.data);
    if (!m) throw '失败1';
    await axios.get('https://www.v2ex.com/mission/daily/redeem?once=' + m[1]);
    var ret = await axios.get('https://www.v2ex.com/mission/daily');
    if (/每日登录奖励已领取/.test(ret.data)) return '成功';
    throw '失败2';
};

/**
 * 检查是否在线接口,可以使用axios库发起请求,请求url域名必须通过@domain声明
 * return true 代表在线
 */
exports.check = async function() {
    var ret = await axios.get('https://www.v2ex.com/mission/daily');
    return ret.status == 200;
};

说明:

  1. 前面的 ==UserScript== 不可少
  2. @name 脚本名称
  3. @namespace 脚本官方网址
  4. @version 脚本版本
  5. @author 脚本作者
  6. @loginURL 登录链接(帮助用户通过这个链接去登录)
  7. @expire 会话过期时间(毫秒),系统会隔一段时间调用一次check接口检查在线状态并保持会话活跃
  8. @domain 请求域名(向用户申明该脚本会访问的域名)
  9. @domain 另一个请求域名(@domain支持多个)
  10. @param 参数键 [参数类型,选填,默认text] 参数说明
  11. (@author,@name)唯一确定一个脚本,重复会被当成一个脚本
  12. 后面的 ==/UserScript== 不可少

更多demos
ps: 作者自己写的脚本用到了async/await不支持低版本浏览器

思路

作者以前用puppeteer做过一套签到工具,用nodejs做过签到站点,不过两者都有一个短板--拿cookie不方便。做成插件的好处就是不用管理cookie,插件不用记录cookie信息,用户不用抓取cookie只需要在浏览器登录账号就行了。

soulsign-chrome's People

Contributors

dependabot[bot] avatar greenskinmonster avatar kukat avatar litecoder avatar sununs avatar sy-records avatar teaim avatar winrey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.