Skip to content

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Spades-S committed Apr 6, 2019
1 parent 25b8c02 commit ea887a8
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 87 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
@@ -1,5 +1,10 @@
* 2.0.0
* Upgrade PicGo-Core to 1.3.2
* Add the log file which contains the info of images uploaded by `vs-picgo`, which can be used by [picgo-plugin-vscode-migrator](https://github.com/upupming/picgo-plugin-vscode-migrator)
* Change `external configuration file property` in picgo config object

* 1.0.6
* Upgrade picgo-core to fix errors caused by comments in a json file
* Upgrade PicGo-Core to fix errors caused by comments in a json file
* Update ReadMe

* 1.0.5
Expand Down
86 changes: 20 additions & 66 deletions README.md
Expand Up @@ -21,72 +21,19 @@
- out of box
* We could use `vs-picgo` without any setting.
* The default image hosting is [SM.MS](https://sm.ms/).
- custom
* insert the content below into `usersetting.json` of VSCode. [Detail information about custom setting](https://picgo.github.io/PicGo-Core-Doc/zh/guide/config.html#%E9%BB%98%E8%AE%A4%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6)

**NOTE: picgo.path is prior to picBed, which means if picgo.path is not empty string, vs-picgo will use the configuration file defined by picogo.path.**

```js
{
"picgo": {
"path": "" // path to your external configure file, default value is "", which means that vs-picgo will use "picBed" info below. External configure file should be a JSON file containing all the "picBed" info below.,
"logPath": "" // path to the json log file which records all uploaded images, default to your_home_dir/vs-picgo-log.json
},
"picBed": {
"current": "smms", // current image hosting, default value is "smms"
"weibo":{ // weibo image hosting
"chooseCookie": true | false,
"username": "",
"password": "",
"quality": "thumbnail" | "mw690" | "large",
"cookie": ""
},
"qiniu": { // qiniu image hosting
"accessKey": "",
"secretKey": "",
"bucket": "",
"url": "",
"area": "", // "z0" -> 华东, "z1" -> 华北, "z2" -> 华南, "na0" -> 北美, "as0" -> 东南亚
"options": "" // prefix of url
"path":"" // postfix of path
},
"upyun": { // upyun image hosting
"bucket": "",
"operator": "",
"password": "",
"options": "",
"path": "",
"url": ""
},
"tcyun": { // tcyun image hosting
"secretId": "",
"secretKey": "",
"bucket": "",
"appId": "",
"area": "",
"path": "",
"customUrl": "",
"version": "v5" | "v4"
},
"github": { // github image hosting
"repo": "",
"token": "",
"path": "",
"customUrl": "",
"branch": "",
"username": ""
},
"aliyun": { // aliyun image hosting
"accessKeyId": "",
"accessKeySecret": "",
"bucket": "",
"area": "",
"path": "",
"customUrl": ""
}
}
}
```
- custom **BIG NEWS From 2.0.0, We can customize the settings in `vscode settings`**
![20190406155436.png](https://i.loli.net/2019/04/06/5ca85b3f1b952.png)

* Use external configuration file
* Enter the path of the configuration file
![20190406155620.png](https://i.loli.net/2019/04/06/5ca85ba6c5858.png)

* Use vscode settings
* First, choose the current PicBed
![20190406155908.png](https://i.loli.net/2019/04/06/5ca85c4f0f93e.png)
* Input all the info current PicBed need
![20190406160045.png](https://i.loli.net/2019/04/06/5ca85cb35667c.png)


## KeyMap

Expand All @@ -102,6 +49,13 @@
* Windows/Unix: `Ctrl + Alt + o`
* OsX: `Cmd + Opt + 0`



#### Migration

* From ^1.0.0
* External configuration file property has changed, from `picgo.path` to `picgo.configPath`.

## Usage

- Find `vs-picgo` in the extension store, and install `vs-picgo`. You can use `vs-picgo` on installation finishes.
Expand Down
File renamed without changes.
23 changes: 15 additions & 8 deletions package.json
Expand Up @@ -2,9 +2,9 @@
"name": "vs-picgo",
"displayName": "%ext.displayName%",
"description": "%ext.description%",
"repository": "https://github.com/Spades-S/vs-picgo",
"issues": "https://github.com/Spades-S/vs-picgo/issues",
"version": "1.0.6",
"repository": "https://github.com/PicGo/vs-picgo",
"issues": "https://github.com/PicGo/vs-picgo/issues",
"version": "2.0.0",
"publisher": "Spades",
"engines": {
"vscode": "^1.27.0"
Expand Down Expand Up @@ -72,13 +72,13 @@
"type": "string",
"enum": [
"smms",
"aliyun",
"github",
"imgur",
"qiniu",
"weibo",
"tcyun",
"upyun",
"aliyun",
"github",
"imgur"
"weibo"
],
"default": "smms",
"markdownDescription": "%config.picBed.description%"
Expand Down Expand Up @@ -122,7 +122,14 @@
},
"picgo.picBed.qiniu.area": {
"type": "string",
"default": ""
"enum": [
"z0",
"z1",
"z2",
"na0",
"as0"
],
"default": "z0"
},
"picgo.picBed.qiniu.options": {
"type": "string",
Expand Down
22 changes: 10 additions & 12 deletions src/extension.ts
@@ -1,12 +1,12 @@
'use strict';
import * as vscode from 'vscode';
import * as os from 'os';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { promisify } from 'util';
import PicGo from 'picgo/dist/core/PicGo';
import { ImgInfo } from 'picgo/dist/utils/interfaces';
type PicGoType = import('picgo/dist/index');
import { promisify } from 'util';
import * as vscode from 'vscode';

const _ = require('lodash');
const _db = require('lodash-id');
_.mixin(_db);
Expand All @@ -15,12 +15,9 @@ const writeFileP = promisify(fs.writeFile);
const readFileP = promisify(fs.readFile);

export interface INotice {
title: string;
body: string;
}

export interface IPicGoCtx {
output: Array<ImgInfo>;
text: string;
title: string;
}

function uploadImageFromClipboard(): void {
Expand Down Expand Up @@ -94,7 +91,7 @@ function getActiveMarkDownEditor(): vscode.TextEditor | undefined {
function upload(editor: vscode.TextEditor, input?: any[]): void {
const imageName = getImageName(editor);
const picgoConfigPath = vscode.workspace.getConfiguration('picgo').get<string>('configPath');
let picgo: PicGoType;
let picgo: PicGo;
if (picgoConfigPath) {
picgo = new PicGo(picgoConfigPath);
} else {
Expand All @@ -117,8 +114,9 @@ function upload(editor: vscode.TextEditor, input?: any[]): void {
}
});
}
// debugger;
picgo.upload(input); // Since picgo-core v1.1.5 will upload image from clipboard without input.
picgo.on('finished', async (ctx: IPicGoCtx) => {
picgo.on('finished', async (ctx: PicGo) => {
let urlText = '';
const logPath = getLogPath();
try {
Expand Down Expand Up @@ -162,8 +160,8 @@ function upload(editor: vscode.TextEditor, input?: any[]): void {
});
picgo.on('notification', (notice: INotice) => {
// Waiting for https://github.com/PicGo/PicGo-Core/pull/9 to be published.
vscode.window.showErrorMessage(notice.title + (notice.body || ''));
reject();
vscode.window.showErrorMessage(`${notice.title} ${notice.body || ''} ${notice.text || ''}`);
});
});
}
Expand Down

0 comments on commit ea887a8

Please sign in to comment.