Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@
"stats": "npm run --silent package -- --env namedChunks=true --profile --json > ./dist/stats.json && webpack-bundle-analyzer ./dist/stats.json ./dist"
},
"activationEvents": [
"workspaceContains:**",
"onView:cnblogs-authorize",
"onView:cnblogs-account",
"onView:cnblogs-post-list",
"onView:vscode-cnb-workspace",
"onCommand:vscode-cnb.workspace.code-open",
"onCommand:vscode-cnb.login.web",
"onCommand:vscode-cnb.logout",
"onCommand:vscode-cnb.ing-publish-select"
"onStartupFinished"
],
"main": "./dist/extension.js",
"contributes": {
Expand Down Expand Up @@ -769,13 +761,13 @@
{
"id": "cnblogs-authorize",
"name": "登录/授权",
"when": "!vscode-cnb.isAuthed",
"when": "vscode-cnb.isUnauthorized",
"visibility": "visible"
},
{
"id": "vscode-cnb-workspace",
"name": "工作空间",
"when": "vscode-cnb.isAuthed",
"when": "!vscode-cnb.isUnauthorized",
"visibility": "collapsed"
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/auth/auth-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export namespace AuthManager {

await execCmd('setContext', `${globalCtx.extName}.isAuthed`, isAuthed)

await execCmd('setContext', `${globalCtx.extName}.isUnauthorized`, !isAuthed)

if (!isAuthed) return

await execCmd('setContext', `${globalCtx.extName}.user`, {
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export async function activate(ctx: ExtensionContext) {
// WRN: For old version compatibility, NEVER remove this line
void LocalState.delSecret('user')

await AuthManager.updateAuthStatus()

setupExtCmd()
setupExtTreeView()

Expand All @@ -28,8 +30,6 @@ export async function activate(ctx: ExtensionContext) {

window.registerUriHandler(extUriHandler)

await AuthManager.updateAuthStatus()

setupUi(LocalState.getExtCfg())

return { extendMarkdownIt }
Expand Down