Code Monkey home page Code Monkey logo

picgo-core's People

Contributors

abnerlee avatar fhyoga avatar jeffersonqin avatar leslie-wong-h avatar molunerfinn avatar neil978 avatar palmcivet avatar spades-s avatar upupming avatar xlzy520 avatar yc910920 avatar zangguojun avatar zhullyb avatar zhumengu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

picgo-core's Issues

无法从WSL读取Windows的剪贴板图片 cannot read winodws clipboard on WSL

image
image
复制了一个图片,分别在cmd和wsl上运行picgo u,cmd的能上传,wsl的无法上传。
Run picgo u on both WSL and cmd after copying an image to clipboard. The image was uploaded on CMD but failed on WSL

WSL version:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic

Error happened when I use picgo-core

sample codes:

  const picGo = new PicGo()
  const result = await picGo.upload([image]) // image is `/Users/ransixi/Downloads/pap.er/x9iToq_5I4k.jpg`

Error:

TypeError: console.Console is not a constructor
    at Logger.handleWriteLog (/Users/ransixi/Documents/marktext/node_modules/picgo/dist/lib/Logger.js:44)
    at /Users/ransixi/Documents/marktext/node_modules/picgo/dist/lib/Logger.js:29
    at processTicksAndRejections (internal/process/task_queues.js:79)

let logger = new console.Console(picgoLog)

【refactor】Refactoring Request with Axios

Since the package request was deprecated, PicGo-Core will replace it with axios which is active and maintained.

The timeline is the following:

  • v1.5.0: replace the request with axios, but the API exposed to the outside world is still consistent. You can still use ctx.Request.request. However, it will be warned with deprecated. The new api is ctx.request. And you can still use both the old request options & the new axios options for requesting.
  • v1.6.0: just simply use ctx.request is OK, though the request lib will be changed to axios. And you can't use ctx.Request.request anymore.
  • v2.0.0: will add an adaptor layer for web & node environment.

Cannot find name PicGo

v.1.4.16 编译出错,是否是部分 PicGo 符号没有改为 IPicGo 接口?

node_modules/picgo/dist/src/types/index.d.ts:200:18 - error TS2304: Cannot find name 'PicGo'.

200   handle: ((ctx: PicGo) => Promise<any>) | ((ctx: PicGo) => void)
                     ~~~~~

node_modules/picgo/dist/src/types/index.d.ts:200:51 - error TS2304: Cannot find name 'PicGo'.

200   handle: ((ctx: PicGo) => Promise<any>) | ((ctx: PicGo) => void)

SM.MS 图床失效

客户端上传至SM.MS 图床失败,简单看了下日志好像是更新升级了API

建议相册功能在本地缓存一部分缩略图

相册功能可以看到最近上传的图片,但是每次好像都是读取图片外链再显示。对于OOS,COS这种就比较不友好,流量费用问题是小事(不过如果相册里面条目很多,每次都请求一遍的话就不是小事了),尤其在开启防盗链相关选项后,本地电脑没办法绑定域名加入白名单,就会无法读取。而使用相册功能大多数情况下我觉得只是查找最近几次上传的照片而已 ,建议在本地缓存一下低分辨率的缩略图,大概区分每张图的内容就,找回生成的链接就可以了。

希望增加一个模式,只输出最后上传成功的 URL

目前的 -s 或者 --silent 模式太 silent 了,都拿不到上传成功的 URL,而非 silent 模式又有一些其他日志,如果从这里拿上传的 URL,还要解析日志信息,希望可以增加一个新模式,只输出上传成功的 URL,对于多个图片,则一行一个。

这样方便在其他 cli 程序不集成 picgo node模块的情况下,获取到用 picgo 上传的图片 URL。

picgo upload 输出结果顺序可能有错误

运行

picgo upload pic1.png pic2.png

输出应该是

[PICGO SUCCESS]
https://xxx.com/pic1.png
https://xxx.com/pic2.png

但可能是一个错误的顺序

[PICGO SUCCESS]
https://xxx.com/pic2.png
https://xxx.com/pic1.png

report a bug

the line "this.pluginIdMap.get(LifecyclePlugins.currentPlugin)?.push(id)" in LifecyclePlugins.ts has a runtime bug:
TypeError: _a.push is not a function

上传前md5修改文件名

再用github作为图床时:

不想用当前时间戳自动命名,想将原文件名自动处理为MD5再上传,这个是必须要自己开发插件吗?
or 有其他更简单的实现方法?

关于自己开发插件的文档有点看不懂..

  1. 个人认为缺少一个最简单的示例指引来告诉开发者应该如何开发
  2. 在调试的过程中,怎么配置config才能使用插件

我这里在~/.picgo下新建项目
然后执行

$ npm install ./picgo-plugin-gitee

接着配置config.json

{
  "picBed": {
    "current": "gitee",
    "uploader": "gitee",
    "transformer": "gitee"
  },
  "picgoPlugins": {
    "picgo-plugin-gitee": true
  },
  "picBed.gitee": {
    "repo": "blog",
    "token": "",
    "path": "image",
    "branch": "",
    "username": "blog"
  }
}

然后我执行

$ picgo -d u "/Users/caijinglong/Desktop/Simulator Screen Shot - iPhone XR - 2019-02-07 at 21.17.44.png"

控制台输出这样的日志

$ picgo -d u "/Users/caijinglong/Desktop/Simulator Screen Shot - iPhone XR - 2019-02-07 at 21.17.44.png"
[PicGo INFO]: Before transform
[PicGo INFO]: Transforming...
[PicGo WARN]: Can't find transformer - gitee, swtich to default transformer - path
[PicGo INFO]: Before upload
[PicGo INFO]: Uploading...
[PicGo WARN]: Can't find uploader - smms, swtich to default uploader - smms
[PicGo SUCCESS]: 

我应该如何配置才能使用gitee作为uploader使用?
总感觉文档内容并不是线性的,我无法按照顺序完成开发过程

处理配置文件里的注释

把lowdb中adapter的serialize, deserialize 分别修改为comment-json的strinify和parse可以更好地处理有注释的json文件

const json = require('comment-json');

const adapter = new FileSync('./data/index.json', {
	serialize(obj) {
		return json.stringify(obj, null, 2);
	},
	deserialize: json.parse,
});

建议PicGo-Server的扩充一个api

我有一个使用场景,公司内几个人用typora写文档,共用一个图床,但不想公开ak、sk。

我想如果PicGo-Server的api能支持post 图片内容,这样就可以把picGo部署到服务器上。写个脚本,把剪贴板图片post到PicGo-Server,这样就可以实现共用图床的功能

“picgo upload" to uplad the first image at clipboard will crash in Win 10

npm update to picgo 1.4.7

However,

“picgo upload" to uplad the first image at clipboard will crash and then cmd window will automatically close in Win 10, yet I have no idea where to look at log file.

image

By the way, the image drag&drop function at this GitHub text box is literally much better than the current version of picgo at my computer——

But it is still worthy to try picgo. :)

可否在上传后将链接复制到粘贴板?

虽然控制台有输出,我现在在用SHAREX截图并调用PICGO上传,因为开机启动的软件太多.所以PIC就用了这个CORE版本,很方便.
如果配合TYPORA使用刚刚好,但有时候在NOTION中用,所以就想直接截图后调用命令上传到图床

目前我是自己弄了个批处理..传递参数进来复制链接地址...

实在是SHAREX不知道怎么上传到GITHUB哈哈...

picgo插件问题

如果我想通过picgo实现删除远程图片或者获取存储空间之类的功能,有实例代码或者插件之类的么。暂时没有看懂插件开发是如何实现的

picgo dist 不应包含 src 目录

现在编译出来的 dist 包含了 src 目录,这样做的目的是什么呢?是不是因为需要 -v 查看版本号引用 package.json 所以保留了原始的 src 目录结构?

image

这样做会造成 import 的时候出现这样的语句:

https://github.com/PicGo/vs-picgo/blob/e8b30b72f5c68a0a31ea98302603968f85ab93bb/src/utils/index.ts#L4

总感觉这样有点奇怪,又有 dist 又有 src,语义上有点歧义。

或者说 vs-picgo 在引用的时候是不是应该直接 import src 文件夹下的内容(import { ImgInfo } from 'picgo/src/utils/interfaces';)?但是目前 picgo 的 src 目录是 npmignore 掉了的,npm install 之后没有 src 文件夹。

希望自定义存储路径支持变量

现在好像只能支持固定的,希望可以自定义路径和文件名变量。

比如定义 %{YYYY}/${MM}/${DD}/ 会出现类似于 2020/09/09/image-2020090919248657.png 这种结果,像一些常见的时间单位都可以增加支持。

同时可以增加一个 filename 配置项,支持变量控制文件名,比如 img-${unixtime} 结合上面的会得到 2020/09/09/img-1599595866576.png 之类的结果。

Add binary release

Would it be possible to output a compiled binary package so that this can be run without installing node and npm?

Perhaps make use of pkg to do so?

This would be extremely beneficial for many of us who are using an environment where we can't install global tools but we can run single binaries.

want schema

Whether to consider adding a schema file for config.json
image

关于上传过程中有几率出现ebadf报错问题

大佬你好,最近在使用你的上传核心的代码进行图片上传。但是在使用的时候,有几率出现ebadf报错。暂时未发现报错代码来源,请问大佬你有思路么。报错时截图如下:
image

picgo command not working in Typora

picgo command works perfectly in terminal. I can upload images successfully. My environment is OS X.

however, when using in Typora, I can only use command line mode.

picgo upload return 'can not find picgo command'
/usr/local/bin/picgo return 'env has no node'

I ask Typora as well, post a message here if someone knows the answer. thanks.

PicGo-Core Roadmap

📌: Ready to do

🚧: Working in progress

✅: Done​

❌: Cancel

TODO Introduction Importance Status
i18n i18n support, English first. [v1.5] ⭐⭐⭐ 📌
Batch upload optimization Optimize batch upload experience && more useful progress information. [v2.0+] ⭐⭐⭐ 📌
Plugin process A single process for running plugins && new async proxy api for plugins. [v2.0] ⭐⭐⭐ 📌
Plugin install & update optimization Ability to install specific versions of plugins. [v1.5+] ⭐⭐⭐ 📌
Plugin execution order Ability to change the execution order of plugins. [1.5+] ⭐⭐⭐ 📌
Notification builtin code For a better "notification" experience. [v1.5+] ⭐⭐ 📌
Browser support Refactor code with adapter mode to support web. [v3.0+] ⭐⭐ 📌
Async event emitter Change the default sync event-emitter to async. [v1.6] ⭐⭐ 📌
And more...

上传阿里云出错

阿里云OSS上传图片出错,但是不是一直出现,而是偶尔会出现(所以应该不是阿里云配置出现问题),异常信息是403 SignatureCanNotMatch,好像是因为生成signature的代码有问题,可以检查一下吗?

请问配置项国际化?

如果写中文的话变量识别不到

const config = ctx => {
    let userConfig = ctx.getConfig('picBed.web-uploader')
    if (!userConfig) {
      userConfig = {}
    }
    return [
      {
        name: 'url',
        type: 'input',
        default: userConfig.url,
        required: true
      }
    ]
  }

picgo use plugins命令无法正确显示已安装的插件

安装插件后运行picgo use plugins命令不提示已安装的插件,导致无法在命令行启用已安装的插件
具体如下:
image-20201218153322490
目前找到的解决方法是把配置文件中的false改为true。
image-20201218153609641
此外,在启用了插件后再运行picgo use plugins,插件可以正常展示:
image-20201218153904264
最后感谢作者,这个软件真的很好用!

上传进度问题

你好,最近在用picgo接入自己业务的时候发现一个问题,在进度显示上好像有点不友好。就算传入多个文件,仿佛uploadProgress事件也只会返回30 60 100,这样的话不利于判断已上传图片数量和未上传图片数量。所以我是需要生成多个picgo实例完成数量监控么?会影响性能么?

码云·

可不可以将码云添加上,github存图片还是比较慢。期待。。。

picgo开发插件错误

我按文档:

ggbang@DESKTOP-K2EEVD4:~/repo$ picgo -h
Usage: picgo [options] [command]

Options:
  -v, --version                        output the version number
  -d, --debug                          debug mode
  -s, --silent                         silent mode
  -c, --config <path>                  set config path
  -p, --proxy <url>                    set proxy for uploading
  -h, --help                           output usage information

Commands:
  install|add [options] <plugins...>   install picgo plugin
  uninstall|rm <plugins...>            uninstall picgo plugin
  update <plugins...>                  update picgo plugin
  set|config <module> [name]           configure config of picgo modules
  upload|u [input...]                  upload, go go go
  use [module]                         use modules of picgo
  init [options] <template> [project]  create picgo plugin's development templates

ggbang@DESKTOP-K2EEVD4:~/repo$ picgo init plugin picgo-plugin-test
[PicGo INFO]: Template files are downloading...
[PicGo SUCCESS]: Template files are downloaded!
? Plugin name: test
? Plugin description: test
? author: 
? Choose modules you want to develop: (Press <space> to select, <a> to toggle all, <i
> to invert selection)
? Your plugin is just used in CLI? No
? Use TS or JS? ts
? Your plugin has some shortcut for GUI? No
[PicGo SUCCESS]: 
Generate template files successfully!
Please cd /home/ggbang/repo/picgo-plugin-test, and then

npm install

# or

yarn
[PicGo SUCCESS]: Done!

ggbang@DESKTOP-K2EEVD4:~/repo$ cd /home/ggbang/repo/picgo-plugin-test

ggbang@DESKTOP-K2EEVD4:~/repo/picgo-plugin-test$ npm install

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this

> [email protected] postinstall /home/ggbang/repo/picgo-plugin-test/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.

added 541 packages from 357 contributors in 14.582s

19 packages are looking for funding
  run `npm fund` for details

接着我在src/index.ts中放入如下代码:

import picgo from 'picgo'

const handle = ctx => {
  let output = ctx.output
  for (let i in output) {
    output[i].imgUrl = 'https://xxxxx.jpg'
  }
  return ctx
}

export = (ctx: picgo) => {
  const register = () => {
    ctx.helper.uploader.register('test', { handle })
  }
  return {
    register,
    uploader: 'test'
  }
}

接着复制文件夹到配置文件所在目录并安装

ggbang@DESKTOP-K2EEVD4:~/repo$ cp -r picgo-plugin-test ~/.picgo/picgo-plugin-test

ggbang@DESKTOP-K2EEVD4:~/.picgo$ npm install ./picgo-plugin-test
npm notice created a lockfile as package-lock.json. You should commit this file.
+ [email protected]
added 1 package in 1.545s

19 packages are looking for funding
  run `npm fund` for details

但当我测试时,错误发生了:

ggbang@DESKTOP-K2EEVD4:~/.picgo$ picgo use
[PicGo ERROR]: { Error: Cannot find module '/home/ggbang/.picgo/node_modules/picgo-plugin-test'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at PluginLoader.getPlugin (/usr/local/lib/node_modules/picgo/dist/src/lib/PluginLoader.js:93:16)
    at PluginLoader.registerPlugin (/usr/local/lib/node_modules/picgo/dist/src/lib/PluginLoader.js:63:22)
    at PluginLoader.load (/usr/local/lib/node_modules/picgo/dist/src/lib/PluginLoader.js:54:18)
    at PicGo.init (/usr/local/lib/node_modules/picgo/dist/src/core/PicGo.js:73:31)
    at new PicGo (/usr/local/lib/node_modules/picgo/dist/src/core/PicGo.js:40:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/picgo/bin/picgo:12:15) code: 'MODULE_NOT_FOUND' }
? Use an uploader (Use arrow keys)
❯ smms 
  tcyun 
  github 
  qiniu 
  imgur 
  aliyun 
  upyun

请问我是否搞错了哪一步,谢谢?

以下是~/.picgo下的文件
1

怎么捕获到报错信息

我想把picgo-core接入到自己的项目中,但是现在提供的钩子里好像无法提供报错信息。
比如我上传的图片路径出错了,picgo可以在命令行里log错误,但是我无法在uploadProgress事件里捕获到错误。
请问是我的用法有问题,还是钩子里确实没有提供错误信息呢

1.4.2有breaking change

dist目录有变更,依赖的子类型路径变了,导致开发和编译报错。

建议这种breaking change积攒起来单独发大版本

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.