diff --git a/package.json b/package.json index 9b52b45..161df21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@beetcb/cea", - "version": "2.0.4", + "version": "2.0.5", "description": "campusphere-elegant-auth: login to swms/campusphere at ease", "main": "dist/index.js", "bin": "dist/cli.js", @@ -27,10 +27,10 @@ }, "license": "ISC", "dependencies": { + "@beetcb/sstore": "^0.0.3", "@iarna/toml": "^2.2.5", "chalk": "^4.1.0", "cheerio": "^1.0.0-rc.5", - "conf": "^9.0.2", "inquirer": "^7.3.3", "node-fetch": "^2.6.1", "tesseract.js": "^2.1.4", diff --git a/src/api.js b/src/api.js index 1f28d69..0264495 100644 --- a/src/api.js +++ b/src/api.js @@ -14,7 +14,7 @@ function loadConfFromToml(path) { } // Useful when we init users/shchool from file/env -conf.load = async function () { +conf.init = async function () { const env = process.env const toml = loadConfFromToml('./conf.toml') const userUlti = new User(conf) diff --git a/src/cli.js b/src/cli.js index 81010bd..ac4cb7a 100644 --- a/src/cli.js +++ b/src/cli.js @@ -2,6 +2,7 @@ const { User, School, conf } = require('./api') ;(async () => { + await conf.load() const argv = process.argv[2] || '' const argv2 = process.argv[3] @@ -23,7 +24,7 @@ const { User, School, conf } = require('./api') case 'rm': case '--remove': { if (argv2 === 'all') conf.clear() - conf.delete(argv2) + conf.del(argv2) break } case 'sign': { @@ -31,8 +32,7 @@ const { User, School, conf } = require('./api') break } case 'load': { - await conf.load() - break + await conf.init() } } })() diff --git a/src/cookie.js b/src/cookie.js index 9b102a1..06298b6 100644 --- a/src/cookie.js +++ b/src/cookie.js @@ -1,10 +1,8 @@ -const Conf = require('conf') +const conf = require('@beetcb/sstore') const log = require('../interface/colorLog') const login = require('../crawler/casLogIn') const { signApp } = require('../campusphere/app') -const conf = new Conf() - // get|store|update cookie synchronizedly, prevent concurrent overlap writes to conf conf.handleCookie = async () => { // Return users with curTask