Compare commits

...

4 Commits

5 changed files with 1249 additions and 23 deletions

1
.npmrc
View File

@@ -1,2 +1,3 @@
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN} //npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
//npm.cnb.cool/kevisual/registry/-/packages/:_authToken=${CNB_API_KEY}
//registry.npmjs.org/:_authToken=${NPM_TOKEN} //registry.npmjs.org/:_authToken=${NPM_TOKEN}

View File

@@ -1,15 +1,14 @@
{ {
"name": "@kevisual/kv-login", "name": "@kevisual/kv-login",
"version": "0.1.14", "version": "0.1.18",
"description": "", "description": "",
"main": "src/main.ts",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "bun bun.config.ts", "build": "rimraf dist && bun bun.config.ts",
"postbuild": "dts -i src/main.ts -o app.d.ts", "postbuild": "dts -i src/main.ts -o app.d.ts",
"build:test": "vite build", "build:test": "vite build",
"prepub": "rm -rf ./dist && pnpm run build:test", "prepub": "rm -rf ./dist && pnpm run build:test",
"pub": "ev deploy ./dist -k login -v 0.1.15 -u -y yes" "pub": "ev deploy ./dist -k login -v 0.1.17 -u -y yes"
}, },
"keywords": [], "keywords": [],
"files": [ "files": [
@@ -19,27 +18,23 @@
], ],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)", "author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT", "license": "MIT",
"packageManager": "pnpm@10.30.1",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {},
"exports": {
".": "./dist/app.js"
},
"devDependencies": {
"@kevisual/cache": "^0.0.5", "@kevisual/cache": "^0.0.5",
"@kevisual/context": "^0.0.8", "@kevisual/context": "^0.0.8",
"@kevisual/query": "^0.0.49", "@kevisual/query": "^0.0.53",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"lit-html": "^3.3.2", "lit-html": "^3.3.2",
"qrcode": "^1.5.4" "qrcode": "^1.5.4",
}, "@kevisual/api": "^0.0.64",
"exports": { "@types/bun": "^1.3.10",
".": "./dist/app.js", "vite": "^8.0.0"
"./types": "./types/index.d.ts"
},
"types": "./types/index.d.ts",
"devDependencies": {
"@kevisual/api": "^0.0.59",
"@types/bun": "^1.3.9",
"vite": "^7.3.1"
} }
} }

1227
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@ export const redirectHome = () => {
if (redirect) { if (redirect) {
setTimeout(() => { setTimeout(() => {
const href = decodeURIComponent(redirect); const href = decodeURIComponent(redirect);
// window.open(href, '_self'); window.open(href, '_self');
console.log('重定向到:', href); console.log('重定向到:', href);
}, 2000); }, 2000);
return; return;

View File

@@ -60,16 +60,19 @@ const getLoginMethodByDomain = (): LoginMethod[] => {
methods = ['password', 'wechat-mp-ticket', 'wechat',] methods = ['password', 'wechat-mp-ticket', 'wechat',]
break; break;
case 'localhost': case 'localhost':
methods = ['password', 'web'] methods = ['web', 'password']
break break
case 'cnb.run': case 'cnb.run':
methods = ['password', 'web'] methods = ['web', 'password']
break; break;
default: default:
methods = ['password', 'web', 'phone', 'wechat', 'wechat-mp', 'wechat-mp-ticket'] methods = ['password', 'web', 'phone', 'wechat', 'wechat-mp', 'wechat-mp-ticket']
break; break;
} }
return DefaultLoginMethods.filter(method => methods.includes(method.id)) return methods.map(m => {
const finded = findLoginMethod(m);
return finded;
}).filter(Boolean) as LoginMethod[];
} }
const getLoginMethod = (methods: LoginMethods[]): LoginMethod[] => { const getLoginMethod = (methods: LoginMethods[]): LoginMethod[] => {
return DefaultLoginMethods.filter(method => methods.includes(method.id)) return DefaultLoginMethods.filter(method => methods.includes(method.id))