Greasy Fork

Greasy Fork is available in English.

feishuHelper

hack feishu

当前为 2022-08-08 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         feishuHelper
// @namespace    http://tampermonkey.net/
// @version      0.11
// @description  hack feishu
// @author       Amos
// @match        https://onetoken.feishu.cn/*
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */

function test(){
  getMyMinutes().then(minutes=>{
    let toRemove = minutes.filter(m=>{
      return Date.now()-m.create_time>24*30*3600*1000
    })
    removeMinute(toRemove).then(()=>{
      console.log('删除成功')
    })
  })
}

function removeMinute(items){
  return new Promise((resolve,reject)=>{
    let nowTs = Date.now()
    let tokens=items.map(i=>i.object_token)
    let data = {language:'zh_cn',object_tokens:tokens.join(','),space_name: 1}
    jQuery.ajax({
      url: `https://onetoken.feishu.cn/minutes/api/space/remove?_t=${nowTs}`,
      dataType: "json",
      contentType: "application/json; charset=utf-8",
      data:data,
      async: true,
      cache: false,
      timeout: 30000,
      success:  (res)=> {
          if(res.code===0){
            resolve()
          } else{
            reject()
          }
      },
      error: (request, status, error)=> {
          reject(error)
      },
      type: "POST"
  });
  })
}
function getMyMinutes(){
  return new Promise((resolve,reject)=>{
    jQuery.ajax({
      url: 'https://onetoken.feishu.cn/minutes/api/space/list',
      dataType: "json",
      data: {size:1000,space_name:1,rank:2,asc:false,owner_type:1,object_token:'',language:'zh_cn'},
      async: true,
      cache: false,
      timeout: 30000,
      success:  (res)=> {
          if(res.code===0){
            resolve(res.data.list)
          } else{
            reject()
          }
      },
      error: (request, status, error)=> {
          reject(error)
      },
      type: "GET"
  });
  })
  
}

(function() {
  'use strict';
  setTimeout(()=>{
    test()
  },5000)
  
})();