Skip to content

Commit

Permalink
Update main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bobostudio committed Dec 21, 2024
1 parent b7f6bfb commit 4cd931e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,21 @@ export default class ImgurPlugin extends Plugin {

async onload() {
await this.loadSettings();
this.uploader = new COSUploader(this.settings);
new Notice("你的图床插件已启动,请先配置腾讯云COS!");

// 检查必要的配置是否已设置
if (!this.settings.secretId || !this.settings.secretKey || !this.settings.bucket) {
new Notice("请先在设置中配置腾讯云 COS 信息!");
// 不初始化 uploader,等待用户配置
} else {
try {
this.uploader = new COSUploader(this.settings);
new Notice("腾讯云 COS 图床插件已启动!");
} catch (error) {
new Notice(`插件初始化失败:${error.message}`);
console.error('Plugin initialization error:', error);
}
}

// 拖拽图片上传处理
this.registerEvent(
this.app.workspace.on('editor-drop', async (evt: DragEvent, editor: Editor, markdownView: MarkdownView) => {
Expand Down

0 comments on commit 4cd931e

Please sign in to comment.