mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-11 18:09:50 +08:00
migrate config file to json; read them via fs.
This commit is contained in:
3
config/boss.json
Normal file
3
config/boss.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"cookies": []
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export const cookies = []
|
||||
3
config/dingtalk.json
Normal file
3
config/dingtalk.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"groupRobotAccessToken": ""
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export const dingTalkAccessToken = ``
|
||||
106
config/target-company-list.json
Normal file
106
config/target-company-list.json
Normal file
@@ -0,0 +1,106 @@
|
||||
[
|
||||
"青钱",
|
||||
"软通动力",
|
||||
"南天",
|
||||
"睿服",
|
||||
"中电金信",
|
||||
"佰钧成",
|
||||
"云链",
|
||||
"博彦",
|
||||
"汉克时代",
|
||||
"柯莱特",
|
||||
"拓保",
|
||||
"亿达信息",
|
||||
"纬创",
|
||||
"微创",
|
||||
"微澜",
|
||||
"诚迈科技",
|
||||
"法本",
|
||||
"兆尹",
|
||||
"诚迈",
|
||||
"联合永道",
|
||||
"新致软件",
|
||||
"宇信科技",
|
||||
"抖音",
|
||||
"字节",
|
||||
"字跳",
|
||||
"有竹居",
|
||||
"脸萌",
|
||||
"头条",
|
||||
"滴滴",
|
||||
"网易",
|
||||
"腾讯",
|
||||
"搜狗",
|
||||
"京东",
|
||||
"百度",
|
||||
"度小满",
|
||||
"爱奇艺",
|
||||
"携程",
|
||||
"趣拿",
|
||||
"去哪儿",
|
||||
"集度",
|
||||
"理想",
|
||||
"顺丰",
|
||||
"讯飞",
|
||||
"同程",
|
||||
"艺龙",
|
||||
"贝壳",
|
||||
"链家",
|
||||
"我爱我家",
|
||||
"多点",
|
||||
"金山",
|
||||
"小米",
|
||||
"猎豹",
|
||||
"新浪",
|
||||
"微博",
|
||||
"阿里",
|
||||
"蚂蚁",
|
||||
"飞猪",
|
||||
"高德",
|
||||
"乌鸫",
|
||||
"美团",
|
||||
"三快",
|
||||
"快手",
|
||||
"映客",
|
||||
"小红书",
|
||||
"行吟",
|
||||
"奇虎",
|
||||
"360",
|
||||
"鸿盈",
|
||||
"奇富",
|
||||
"亚信",
|
||||
"启明星辰",
|
||||
"奇安信",
|
||||
"汽车之家",
|
||||
"车好多",
|
||||
"瓜子",
|
||||
"易车",
|
||||
"昆仑万维",
|
||||
"闲徕",
|
||||
"趣加",
|
||||
"完美",
|
||||
"马上消费",
|
||||
"轻松",
|
||||
"水滴",
|
||||
"白龙马",
|
||||
"58",
|
||||
"车欢欢",
|
||||
"五八",
|
||||
"红布林",
|
||||
"致美",
|
||||
"美餐",
|
||||
"知乎",
|
||||
"易点云",
|
||||
"搜狐",
|
||||
"用友",
|
||||
"畅捷通",
|
||||
"猿辅导",
|
||||
"小猿",
|
||||
"猿力",
|
||||
"好未来",
|
||||
"学而思",
|
||||
"希望学",
|
||||
"新东方",
|
||||
"东方甄选",
|
||||
"作业帮"
|
||||
]
|
||||
@@ -1,119 +0,0 @@
|
||||
export default [
|
||||
'青钱',
|
||||
'软通动力',
|
||||
'南天',
|
||||
'睿服',
|
||||
'中电金信',
|
||||
'佰钧成',
|
||||
'云链',
|
||||
'博彦',
|
||||
'汉克时代',
|
||||
'柯莱特',
|
||||
'拓保',
|
||||
'亿达信息',
|
||||
'纬创',
|
||||
'微创',
|
||||
'微澜',
|
||||
'诚迈科技',
|
||||
'法本',
|
||||
'兆尹',
|
||||
'诚迈',
|
||||
'联合永道',
|
||||
'新致软件',
|
||||
'宇信科技',
|
||||
//
|
||||
'抖音', '字节', '字跳', '有竹居', '脸萌', '头条',
|
||||
//
|
||||
'滴滴',
|
||||
//
|
||||
'网易',
|
||||
//
|
||||
'腾讯', '搜狗',
|
||||
//
|
||||
'京东',
|
||||
//
|
||||
'百度',
|
||||
//
|
||||
'度小满',
|
||||
//
|
||||
'爱奇艺',
|
||||
//
|
||||
'携程', '趣拿', '去哪儿',
|
||||
//
|
||||
'集度',
|
||||
//
|
||||
'理想',
|
||||
//
|
||||
'顺丰',
|
||||
//
|
||||
'讯飞',
|
||||
//
|
||||
'同程', '艺龙',
|
||||
//
|
||||
'贝壳', '链家',
|
||||
//
|
||||
'我爱我家',
|
||||
//
|
||||
'多点',
|
||||
//
|
||||
'金山', '小米', '猎豹',
|
||||
//
|
||||
'新浪', '微博',
|
||||
//
|
||||
'阿里', '蚂蚁', '飞猪', '高德', '乌鸫',
|
||||
//
|
||||
'美团', '三快',
|
||||
//
|
||||
'快手',
|
||||
//
|
||||
'映客',
|
||||
//
|
||||
'小红书', '行吟',
|
||||
//
|
||||
'奇虎', '360', '鸿盈', '奇富',
|
||||
//
|
||||
'亚信',
|
||||
//
|
||||
'启明星辰',
|
||||
//
|
||||
'奇安信',
|
||||
//
|
||||
'汽车之家',
|
||||
//
|
||||
'车好多', '瓜子',
|
||||
//
|
||||
'易车',
|
||||
//
|
||||
'昆仑万维', '闲徕',
|
||||
//
|
||||
'趣加',
|
||||
//
|
||||
'完美',
|
||||
//
|
||||
'马上消费',
|
||||
//
|
||||
'轻松',
|
||||
//
|
||||
'水滴',
|
||||
//
|
||||
'白龙马',
|
||||
//
|
||||
'58', '车欢欢', '五八', '红布林', '致美',
|
||||
//
|
||||
'美餐',
|
||||
//
|
||||
'知乎',
|
||||
//
|
||||
'易点云',
|
||||
//
|
||||
'搜狐',
|
||||
//
|
||||
'用友', '畅捷通',
|
||||
//
|
||||
'猿辅导', '小猿', '猿力',
|
||||
//
|
||||
'好未来', '学而思', '希望学',
|
||||
//
|
||||
'新东方', '东方甄选',
|
||||
'作业帮'
|
||||
]
|
||||
@@ -1,16 +1,35 @@
|
||||
import puppeteer from 'puppeteer-extra';
|
||||
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
|
||||
|
||||
import { cookies as bossCookies } from '../../config/boss.mjs'
|
||||
import targetCompanyList from '../../config/target-company-list.mjs'
|
||||
|
||||
import {
|
||||
sleep,
|
||||
sleepWithRandomDelay
|
||||
} from '@bossgeekgo/utils/sleep.mjs'
|
||||
|
||||
import fs from 'node:fs'
|
||||
import { get__dirname } from '@bossgeekgo/utils/legacy-path.mjs';
|
||||
import path from 'node:path';
|
||||
|
||||
puppeteer.use(StealthPlugin())
|
||||
|
||||
const { cookies: bossCookies } = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(
|
||||
get__dirname(),
|
||||
'../../config/boss.json'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const targetCompanyList = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(
|
||||
get__dirname(),
|
||||
'../../config/target-company-list.json'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if (!bossCookies?.length) {
|
||||
console.error('There is no cookies. you can save a copy with EditThisCookie extension.')
|
||||
process.exit(1)
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
import DingtalkPlugin from '@bossgeekgo/dingtalk-plugin/index.mjs'
|
||||
import { dingTalkAccessToken } from "../../config/dingtalk.mjs"
|
||||
import { mainLoop } from '@bossgeekgo/geek-auto-start-chat-with-boss/index.mjs'
|
||||
import {
|
||||
SyncHook,
|
||||
AsyncSeriesHook
|
||||
} from 'tapable'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { get__dirname } from '@bossgeekgo/utils/legacy-path.mjs';
|
||||
|
||||
const { groupRobotAccessToken: dingTalkAccessToken } = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(
|
||||
get__dirname(),
|
||||
'../../config/dingtalk.json'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const initPlugins = (hooks) => {
|
||||
new DingtalkPlugin(dingTalkAccessToken).apply(hooks)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@bossgeekgo/dingtalk-plugin": "workspace:*",
|
||||
"@bossgeekgo/geek-auto-start-chat-with-boss": "workspace:*"
|
||||
"@bossgeekgo/geek-auto-start-chat-with-boss": "workspace:*",
|
||||
"@bossgeekgo/utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
3
packages/utils/legacy-path.mjs
Normal file
3
packages/utils/legacy-path.mjs
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as url from 'url';
|
||||
export const get__filename = () => url.fileURLToPath(import.meta.url);
|
||||
export const get__dirname = () => url.fileURLToPath(new URL('.', import.meta.url));
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -40,6 +40,9 @@ importers:
|
||||
'@bossgeekgo/geek-auto-start-chat-with-boss':
|
||||
specifier: workspace:*
|
||||
version: link:../geek-auto-start-chat-with-boss
|
||||
'@bossgeekgo/utils':
|
||||
specifier: workspace:*
|
||||
version: link:../utils
|
||||
|
||||
packages/ui:
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user