Giter Site home page Giter Site logo

pluveto / upgit Goto Github PK

View Code? Open in Web Editor NEW
530.0 6.0 44.0 256 KB

Another upload hub that supports clipboard. It works well with Typora, Snipaste, VSCode.

License: MIT License

Go 97.94% Makefile 2.06%
typora upload uploader github command image imgur chevereto imgbb obsidian

upgit's Issues

upgit 1.png报错

=>:upgit 1.png
panic: assignment to entry in nil map

goroutine 1 [running]:
main.main()
/home/runner/work/upgit/upgit/main.go:91 +0x31c

报错x509

Failed: Put "https://api.github.com/repos/***/****/contents/upgit/2022/02/upgit_20220202_1643738255.png": x509: certificate is valid for *.googlevideo.com, *.a1.googlevideo.com, *.bdn.dev, *.c.doc-0-0-sj.sj.googleusercontent.com, *.c.2mdn.net, *.dai.googlevideo.com, *.googlezip.net, *.gvt1.com, *.offline-maps.gvt1.com, *.snap.gvt1.com, *.gcpcdn.gvt1.com, xn--ngstr-lra8j.com, *.xn--ngstr-lra8j.com, i.ytimg.com, play-lh.googleusercontent.com, not api.github.com

panic: clipboard: cannot use when CGO_ENABLED=0

請問:是macOS需要做權限方面的設定嗎?應如何解決?

[18:36:32] jerry ➜ ~/Documents » upgit :clipboard -f markdown-simple
panic: clipboard: cannot use when CGO_ENABLED=0

goroutine 1 [running]:
golang.design/x/clipboard.initialize(...)
	/home/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard_nocgo.go:9
golang.design/x/clipboard.Init(...)
	/home/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard.go:102
main.loadClipboard(0x12c2fe0?)
	/home/runner/work/upgit/upgit/main.go:236 +0x66
main.main()
	/home/runner/work/upgit/upgit/main.go:99 +0x41b
[18:40:12] jerry ➜ ~/Documents »

有人能帮忙看看配置文件哪里错了么,总是报错

config.toml
以下为文件内容
default_uploader = "github"
branch = "main"
pat = "ghp_TikdmhPW9qeIXgGxxxxxxxxxxxxxxxxxxx" #此处隐藏
rename = "{year}/{month}/upgit_{year}{month}{day}_{unix_ts}{ext}"
repo = "lb8023lyy/Image"
username = "lb8023lyy"
[replacements]
"raw.githubusercontent.com" = "cdn.jsdelivr.net/gh"
"/main" = "@main"
[output-formats]
"markdown-simple" = ""

自定义API支持

目前无论是picgo 还是 upic 都支持自定义API。这样就不需要重复开发了,可以把大部分工作交给用户自定义

upic 示意:
image
picgo 示意:
image

上传报错

错误日志:

2022-04-22 00:38:06.977034861 +0800 CST m=+0.000697220[INFO ] Started
2022-04-22 00:38:06.977117796 +0800 CST m=+0.000780054[ERROR] abort: $HOME is not defined
goroutine 1 [running]:
runtime/debug.Stack()
	/Users/runner/hostedtoolcache/go/1.18.0-beta1/x64/src/runtime/debug/stack.go:24 +0x65
github.com/pluveto/upgit/lib/xlog.Verbose.Log({0x38?, 0x61?, {0xc0000160f0?, 0xc000091c80?}, 0x40ce47?}, {0x71bc87, 0x8}, {0xc000091ca0?, 0xc000091cc8?}, {0x0, ...})
	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:55 +0x12a
github.com/pluveto/upgit/lib/xlog.Verbose.Error(...)
	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:44
github.com/pluveto/upgit/lib/xlog.AbortErr({0x7a6000?, 0xc000020f80?})
	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:93 +0xf9
main.loadConfig(0x957160)
	/Users/runner/work/upgit/upgit/main.go:191 +0x8f
main.mainCommand()
	/Users/runner/work/upgit/upgit/main.go:49 +0x35
main.main()
	/Users/runner/work/upgit/upgit/main.go:40 +0x7b

能否支持上传剪贴板中的.png文件

我目前在搭配obsidian(基于markdown的笔记软件)使用upgit, 所以很希望upgit能够实现批量处理图片.
比如将某一文件夹下的所有本地图片批量上传并将所有的url导出到剪贴板.

所以现场截图进行上传获取链接对我而言不太够用, 最好能支持将本地图片文件复制到剪贴板中然后进行上传然后再返回url至剪贴板. 我有尝试复制单一图片文件到剪贴板然后使用upgit上传, 失败的反馈信息是当前剪贴板中没有图像或格式不支持.
图片

总而言之, 就是希望增加对本地图片通过剪贴板的处理, 如果能支持对本地图片的批量处理那就更好了.

toml配置文件必须将[]方括号整行删掉才可正常使用

我不知道是由于我哪里出了配置问题,但是在不注释掉全部的方括号行前,我是无法使用的,错误提示如下:
incorrect config: Username: zero value, Repo: zero value, PAT: zero value
疑似 [uploaders.github] 这一行出现问题

rename 占位符

  1. 缺少类似于{h}{m}{s} 时分秒的占位符;
  2. 原始文件名 {fname} 不生效;
    image

便携版

PicGo之前看issue是无望了,每次重装系统都要重新配置。不知这个应用是否支持?

关于上传非图片文件

  • 在picgo-core中,你复制一个文件,然后就能快捷键上传到网盘。

local file path to upload. :clipboard for uploading clipboard image.

  • 看意思是说upgit是无法上传剪贴板中除了图片以外的其他文件,只能用命令行upgit abc.* 方式上传其他格式文件。

  • 问题:有没有更方便一点的方法,比如批处理之类的吧,让人不用每次都要输入一次路径命令。

mac上从剪贴板上传一直提示“failed: no image in clipboard or unsupported format”

但是实际剪贴板是有图片的

2022-02-21 16:41:51.043596 +0800 CST m=+0.000626072[INFO ] Started
2022-02-21 16:41:51.050874 +0800 CST m=+0.007904413[ERROR] abort: failed: no image in clipboard or unsupported format
goroutine 1 [running]:
runtime/debug.Stack()
	/Users/runner/hostedtoolcache/go/1.18.0-beta1/x64/src/runtime/debug/stack.go:24 +0x65
github.com/pluveto/upgit/lib/xlog.Verbose.Log({0xc0?, 0x63?, {0xc00001e198?, 0xc000079860?}, 0xc000127e40?}, {0x4323438, 0x8}, {0xc000016400?, 0x33?}, {0x0, ...})
	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:55 +0x12a
github.com/pluveto/upgit/lib/xlog.Verbose.Error(...)
	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:44
github.com/pluveto/upgit/lib/xlog.AbortErr({0x43ad4c0?, 0xc00004d0b0?})
	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:93 +0xf9
main.loadClipboard()
	/Users/runner/work/upgit/upgit/main.go:360 +0x231
main.mainCommand()
	/Users/runner/work/upgit/upgit/main.go:53 +0x85
main.main()
	/Users/runner/work/upgit/upgit/main.go:39 +0x7b

限制了5m左右大小?能解除吗?

很好用。很方便,原先用的picgo-core的打包exe版本,比较繁重

目前用这个上传蛮方便的,就是大小限制了,一开始还以为我ahk脚本弄错了

typora使用smms图床报错

open C:\Users\zzz\AppData\Roaming\Typora\extensions: The system cannot find the file specified.

这是要自己新建一个文件夹extensions,然后下载代码库里面对应的比如smms.jsonc放进去?readme里面没写啊。

而且做了以上步骤还是不行,Post "https://sm.ms/api/v2/upload": net/http: TLS handshake timeout,我猜是被樯了?

smms.jsonc里面换成smms.app域名也不行,换成"url": "https://smms.app/api/v2/upload",,报错Failed: rawUrl path is not valid: for path data.url, key data not found

到底该怎么办,整了一下午快自闭了。

配置环境变量后依然无法运行upgit

开发者你好,使用的windows,系统信息如下

Edition	Windows 10 Enterprise LTSC
Version	21H2
Installed on	‎1/‎1/‎2022
OS build	19044.2486
Experience	Windows Feature Experience Pack 120.2212.4190.0

下载upgit_win_amd64.exe或 upgit_win_386.exe 到本地E:\download\app\upgit路径并重命名upgit.exe,已配置config.toml 文件,添加个人环境变量:upgit, 路径为E:\download\app\upgitE:\download\app\upgit\upgit.exe后,使用cmd命令where upgit均无法找到upgit命令 INFO: Could not find files for the given pattern(s). ,直接使用命令如upgit :clipboard -o clipboard -f bbcode,提示 'upgit' is not recognized as an internal or external command, operable program or batch file.请问如何解决?

[功能请求] 删除无用的文件

有时候上传的文件经过多次修改,之前的图片文件失去作用而又占据空间,能不能实现清理之前文件的功能?或者能否提供一下实现思路?谢谢!

Upload clipboard fail on mac

upgit :clipboard -V

[TRACE] LocalPaths = [':clipboard']
        TargetDir = ''
        Verbose = true
        Wait = false
        Clean = false
        Raw = false
        NoLog = false
        Uploader = ''
        OutputType = 'stdout'
        OutputFormat = 'url'
        ApplicationPath = ''
[TRACE] default_uploader = 'github'
        rename = '{year}/{month}/upgit_{year}{month}{day}_{unixts}{ext}'
        [output_formats]
        bbcode = '[img]{url}[/img]'
        html = '<img src="{url}" />'
        markdown = '![{url_fname}]({url})'
        markdown-simple = '![]({url})'
        url = '{url}'
panic: clipboard: cannot use when CGO_ENABLED=0

goroutine 1 [running]:
golang.design/x/clipboard.initialize(...)
	/home/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard_nocgo.go:9
golang.design/x/clipboard.Init(...)
	/home/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard.go:102
main.loadClipboard()
	/home/runner/work/upgit/upgit/main.go:343 +0xa4
main.mainCommand()
	/home/runner/work/upgit/upgit/main.go:53 +0x9c
main.main()
	/home/runner/work/upgit/upgit/main.go:39 +0xb8

typora 報錯401

報錯內容:
fail to parse result image path from: Failed: unexpected status code 401.
response: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}

配置:

默认上传器

default_uploader = "github"

Github 上传器

[uploaders.github]

保存文件的分支,例如 master 或 main

branch = "master"

您的拥有"repo"权限的 Github 令牌

获取Github Token连接: https://github.com/settings/tokens

pat = "ghp_*************************************" //此處隱藏

您的公共Github存储库的名称

注意: 为了让您和他人可以访问到图片资源, 您的Github仓库一定要是公开的,

在私有仓库中Github会拦截未授权的请求,你将会得到一个404.

repo = "picbed"

您的 Gtihub 用户名

username = "syuanc19"

--
不知為何總是報錯,查了查都是404,不曉得401是甚麼情況,謝謝

Help me fix CI/CD bugs

It doesn't build on MacOS agent. We need to rewrite workflow for Github Action. Any volunteer?

剪贴板能否增强一下

剪贴板只能上传PNG图片,能否也可以上传其他格式文件。上传其他格式不得不用命令行逐条进行,远没有上传图片时,快捷键一键上传来得方便,特麻烦。

ubuntu can not upload image in clipboard

gabriel@gabriel-HP-ProDesk-600-G2-SFF:~$ upgit :clipboard
panic: clipboard: cannot use when CGO_ENABLED=0

goroutine 1 [running]:
golang.design/x/clipboard.initialize(...)
	/Users/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard_nocgo.go:9
golang.design/x/clipboard.Init(...)
	/Users/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard.go:102
main.handleClipboard()
	/Users/runner/work/upgit/upgit/main.go:373 +0x46a
main.mainCommand()
	/Users/runner/work/upgit/upgit/main.go:59 +0x85
main.main()
	/Users/runner/work/upgit/upgit/main.go:45 +0x7b
gabriel@gabriel-HP-ProDesk-600-G2-SFF:~$ go version
go version go1.19.5 linux/amd64
gabriel@gabriel-HP-ProDesk-600-G2-SFF:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy
gabriel@gabriel-HP-ProDesk-600-G2-SFF:~$ 

I tested uploading image file, it works fine

gabriel@gabriel-HP-ProDesk-600-G2-SFF:~$ upgit Pictures/Screenshots/Screenshot\ from\ 2023-01-24\ 10-40-02.png 
https://raw.githubusercontent.com/cbweixin/seleniumdemo/master/2023/01/upgit_20230124_1674585891.png

thanks a lot for your help!

upgit :clipboard-file -o clipboard

上传时,如果文件名为中文,那么就会失败,弄了半天,不知道乍l回事,原来是不支持中文。希望大佬能解决一下。

^F8:: ;单文件上传
RunWait, "upgit.exe" :clipboard-file
return
^F9:: ;多文件上传
RunWait, "upgit.exe" :clipboard-files
return

这2条AHK命令感觉可以做到无论上传几个文件都只用一个命令。不懂编码,但从使用别的软件上感觉这应该可以。

同学,您这个项目引入了47个开源组件,存在2个漏洞,辛苦升级一下

检测到 pluveto/upgit 一共引入了47个开源组件,存在2个漏洞

漏洞标题:Go SSH拒绝服务漏洞
缺陷组件:golang.org/x/[email protected]
漏洞编号:CVE-2020-9283
漏洞描述:Go SSH是一个使用go语言开发的极度简洁的ssh工具,用于远程管理linux、unix等机器。
Go SSH存在拒绝服务漏洞,该漏洞源于网络系统或产品未对输入的数据进行正确的验证,攻击者可利用该漏洞导致拒绝服务条件,拒绝向合法用户提供服务。
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-14300
影响范围:(∞, 0.0.0-20200220183623-bac4c82f6975)
最小修复版本:0.0.0-20200220183623-bac4c82f6975
缺陷组件引入路径:github.com/pluveto/upgit@->golang.org/x/[email protected]>golang.org/x/[email protected]>golang.org/x/[email protected]

另外还有2个漏洞,详细报告:https://mofeisec.com/jr?p=ae53d1

Upgrade dependency "github.com/pelletier/go-toml"

Background

Repo github.com/pluveto/upgit depends on github.com/pelletier/go-toml/[email protected].

https://github.com/pluveto/upgit/blob/main/go.mod#L9

However, comparing version v2.0.0-beta.6 of github.com/pelletier/go-toml from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
      "name": "GitHub",
      "email": "[email protected]",
      "date": "2022-04-07T23:51:09Z"
    }

commit time of the copy on proxy.golang.org

{"Version":"v2.0.0-beta.6","Time":"2022-01-01T01:03:18Z"}

So the checksum from the code in github does not match the checksum saved in sum.golang.org. The v2.0.0-beta.6 tag of github.com/pelletier/go-toml might have been retagged after a minor edition on github. I guess you use proxy.golang.org to get dependencies, but that also shows that your project is depending on the copy of github.com/pelletier/[email protected] before its edition. Depending upon such inconsistent tag version may also result in some unexpected errors as well as build errors due to different proxy settings.

For example, when someone who does not use proxy.golang.org, say GOPROXY=direct, attempts to get github.com/pelletier/go-toml/[email protected], the following error occurs.

go: downloading github.com/pelletier/go-toml/v2 v2.0.0-beta.6
go: github.com/pelletier/go-toml/v2@v2.0.0-beta.6: verifying module: checksum mismatch
        downloaded: h1:wURrrr62LqAzIR22w6KSpuDTdzPljPWc5UrtWOsWPfU=
        sum.golang.org: h1:JFNqj2afbbhCqTiyN16D7Tudc/aaDzE2FBDk+VlBQnE=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

So, this is a reminder in the hope that you can get rid of this problematic version of project github.com/pelletier/go-toml.

Solution

1. Bump the version of dependency github.com/pelletier/go-toml

I would recommend bumping the version of github.com/pelletier/go-toml to a new release to ensure dependency copy in proxy.golang.org and github in sync.

References

win11 upgitrc 不可用

Upgit v0.2.16

用户目录下 .upgit.config.toml 可以正常使用

PS C:\Users\xxx> mv .\.upgit.config.toml .\.config\upgitrc 移动到 .config\upgitrc 后报错

no config file found

scoop 也在用 .config 目录做配置,想把配置文件汇聚到一起。

上传有大小限制吗?

传不上去,日志如下:

2022-09-14 08:51:07.915924 +0800 CST m=+0.000319876[INFO ] Started
2022-09-14 08:51:07.925968 +0800 CST m=+0.010363584[ERROR] abort: invalid file to upload /var/folders/hc/my4442h94j5983yx1xdkrsk00000gn/T//upgit_tmp_1663116667916137.png: file size is larger than 5242880 bytes
goroutine 1 [running]:
runtime/debug.Stack()
/Users/runner/hostedtoolcache/go/1.18.0-beta1/x64/src/runtime/debug/stack.go:24 +0x68
github.com/pluveto/upgit/lib/xlog.Verbose.Log({0xc8?, 0x5d?, {0x14000156210?, 0x10?}, 0x140001a8000?}, {0x1023575ad, 0x8}, {0x140001aa000?, 0x1023526cc?}, {0x0?, ...})
/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:55 +0xf8
github.com/pluveto/upgit/lib/xlog.Verbose.Error(...)
/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:44
github.com/pluveto/upgit/lib/xlog.AbortErr({0x102458c68?, 0x1400011aee0?})
/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:93 +0xe8
main.validArgs()
/Users/runner/work/upgit/upgit/main.go:182 +0x310
main.mainCommand()
/Users/runner/work/upgit/upgit/main.go:57 +0xa0
main.main()
/Users/runner/work/upgit/upgit/main.go:40 +0xb8

这种情况如何处理呢?支持修改大小上限值吗

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.