• This repository has been archived on 02/Jul/2022
  • Stars
    star
    588
  • Rank 76,022 (Top 2 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created about 10 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A ShareX clone for Linux and FreeBSD.

Table of Contents generated with DocToc

ShareNix is a ShareX clone for Linux and FreeBSD. It features image/screenshot and file uploading to almost any file/image sharing service that has an API thanks to the easily customizable json configuration.

ShareNix is somewhat compatible with ShareX's json config format. If you're a ShareX user, you can easily import your settings by pasting them in the Services section of sharenix.json

this was one of my first golang projects. don't expect good code

the project is mostly in mainteinance mode. I don't have interest in developing it further as I have been moving to a minimal setup with just a shell script to upload screenshots. but I don't mind pushing small improvements here and there

Installing - Arch Linux

if you use arch linux, there's an aur package that compiles and installs the latest version of ShareNix for you:

pacman -S --needed base-devel
pacman -S git
git clone https://aur.archlinux.org/sharenix-git.git
cd sharenix-git
makepkg -si

customize your config by copying /etc/sharenix.json to ~/.sharenix.json and editing it

Installing - Void Linux

sudo xbps-install sharenix scrot

customize your config by copying /etc/sharenix.json to ~/.sharenix.json and editing it

Installing - Prebuilt binaries

download the latest release from https://github.com/Francesco149/sharenix/releases

tar xvf sharenix-*.tar.xz

sudo cp sharenix-*/sharenix /usr/bin
sudo chmod +x /usr/bin/sharenix
sudo cp sharenix-*/src/sharenix-section /usr/bin
sudo chmod +x /usr/bin/sharenix-section
sudo cp sharenix-*/src/sharenix-window /usr/bin
sudo chmod +x /usr/bin/sharenix-window 

cp sharenix-*/sharenix.json ~/.sharenix.json
sharenix -h

Usage

  • sharenix -h for a list of available options
  • sharenix-section to select a region and upload it
  • sharenix-window to screenshot a window and upload it

You can now set-up sharenix any way you like: bind it to hotkeys, launch it from your terminal, and so on.

Check out the sharenix.json config file for the example configuration. I might document the config format some day, but the behaviour is nearly the same as ShareX so you could just read through this section of the ShareX guide. ShareNix supports most of the json syntax.

sharenix.json locations, from highest to lowest priority:

~/.sharenix.json
(base path to sharenix's executable)/sharenix.json
/etc/sharenix.json
/usr/local/etc/sharenix.json
$XDG_CONFIG_HOME/sharenix/sharenix.json
~/.config/sharenix/sharenix.json

The first config file that is found, starting from top to bottom, will be used.

Notifications and canceling uploads

Using the -n flag will enable notifications for uploads in the bottom right corner of your screen.

Right-clicking a "upload in progress" notification will cancel the upload and dismiss the notification.

Right-click a "upload completed" notification will dimiss it, while left clicking the url will open it in your default browser.

If for whatever reason notification positions get buggy, reset the locks by running:

rm ~/sharenix/.notify*

Screenshotting areas or windows

Until window and area grabbing are built into sharenix, you can use pretty much any screenshotting tool and pass its image to sharenix.

If you have xfce4-screenshooter, you can use xfce4-screenshooter -r -o "sharenix -n" for regions and xfce4-screenshooter -w -o "sharenix -n" for windows.

As a more generic solution, I have written two glue scripts that query xfce4-screenshooter, gnome-screenshot and scrot and automatically pass the result to sharenix for uploading. if you followed the install instructions, they should already be installed.

Now you can bind these scripts to hotkeys using whatever configuration your DE/Window Manager has.

DWM example config (edit config.h and recompile dwm):

char const* sharenix2cmd[] = { "sharenix", "-n", "-c", "-m=fs", 0 };
char const* sharenix3cmd[] = { "sharenix-window", 0 };
char const* sharenix4cmd[] = { "sharenix-section", 0 };
char const* sharenix5cmd[] = { "sharenix", "-n", "-c", "-m=c", 0 };
Key keys[] = {
    { ControlMask|ShiftMask, XK_2, spawn, {.v = sharenix2cmd } },
    { ControlMask|ShiftMask, XK_3, spawn, {.v = sharenix3cmd } },
    { ControlMask|ShiftMask, XK_4, spawn, {.v = sharenix4cmd } },
    { ControlMask|ShiftMask, XK_5, spawn, {.v = sharenix5cmd } },
    /* ... */

JWM example config (~/.jwmrc):

<Key mask="CS" key="2">exec:sharenix -m="fs" -n -o</Key>
<Key mask="CS" key="3">exec:/path/to/sharenix-window</Key>
<Key mask="CS" key="4">exec:/path/to/sharenix-section</Key>
<Key mask="CS" key="5">exec:sharenix -m="c" -n</Key>
<Key mask="CS" key="i">exec:sharenix -m="c" -n -s="twitter (gweet)"</Key>

i3wm example config (~/.i3/config):

bindsym Ctrl+Shift+2 exec sharenix -m="fs" -n -o
bindsym Ctrl+Shift+3 exec /path/to/sharenix-window
bindsym Ctrl+Shift+4 exec /path/to/sharenix-section
bindsym Ctrl+Shift+5 exec sharenix -m="c" -n
bindsym Ctrl+Shift+i exec sharenix -m="c" -s="twitter" -n

fluxbox example config (~/.fluxbox/keys):

Control Shift 2 :Exec sharenix -m="fs" -n -o
Control Shift 3 :Exec /path/to/sharenix-window
Control Shift 4 :Exec /path/to/sharenix-section
Control Shift 5 :Exec sharenix -m="c" -n
Control Shift i :Exec sharenix -m="c" -n -s="twitter (gweet)"

On ubuntu and similar distros, you can bind them to hotkeys in CompizConfig Settings Manager under commands

Feature progress

  • Parsing ShareX's json config - done

  • Parsing regexp tags - done (no named groups)

  • Parsing tags in the parameters - done

  • JSON syntax $json:some.json.field$ - done

  • XML syntax $xml:/root/some/xml/field$ - done (untested)

  • Custom Headers - done

  • File upload - done (./sharenix path/to/file)

  • Full-screen screenshot - done (./sharenix -m=fs)

  • Upload files and images from clipboard - done (./sharenix -m=c)

  • Automatically open uploads in browser if requested - done (-o flag)

  • Archiving clipboard and screenshot uploads to a local folder - done (saved in ~/sharenix/archive/)

  • Plugin system - done (still very early)

  • Upload text from clipboard - done

  • URL shortening - done

  • Screen region selection - done, uses external tools

  • Basic upload history csv file - done (./sharenix -history)

  • Grep-able upload history output - done (./sharenix -history | grep helloworld)

  • Clickable GTK notifications - done (-n flag)

  • GUI tools for config & history - I have decided that this is out of the scope of this project as I don't care about GUI. but if you made a gui for sharenix you are welcome to show off your project

Getting started - Building from the source

NOTE: this codebase is quite outdated (it was written back in go 1.4 or something like that). I don't plan on refactoring the code for now. If you encounter issues while trying to compile it, please downgrade to go 1.7.1 or earlier.

Before we start building ShareNix, you will need to set up a few dependencies.

  • Get the dev headers for glib, cairo, pango and gtk2. On debian-ubuntu you just need to install libgtk2.0-dev
  • Make sure that you have go >=1.3.1

It should be possible to automatically get all the dependencies by simply running:

go get github.com/Francesco149/sharenix

If you get any errors, try getting the dependencies individually:

go get github.com/mattn/go-gtk/gtk
go get github.com/BurntSushi/xgb
go get mvdan.cc/xurls
go get github.com/ChrisTrenkamp/goxpath
go get github.com/Francesco149/jsonpath
go get github.com/kardianos/osext
go get github.com/Francesco149/sharenix

You can also manually clone the repository anywhere you want by running

git clone https://github.com/Francesco149/sharenix.git

To build sharenix, simply run

go install github.com/Francesco149/sharenix

and copy the default config file to $GOPATH/bin

cp $GOPATH/src/github.com/Francesco149/sharenix/sharenix.json $GOPATH/bin/sharenix.json

then run it (in this example I'm going to be uploading a full-screen screenshot to the default site)

cd $GOPATH/bin
./sharenix -m=fs

Example: Upload to your personal imgur account

this is a temporary solution until there's proper oauth support built in

visit this page and authorize the application. It will redirect you to the homepage of imgur, but with a token in the URL

the URL will look like

https://imgur.com/#access_token=something&... (other stuff we don't care about)

you want the value of access_token ("something" in this example).

the config is the exact same as the anonymous imgur upload except that instead of the Client-ID you have Bearer something where "something" is your access_token.

        {
            "Name": "imgur.com (account)",
            "RequestType": "POST",
            "Headers": {
                "Authorization": "Bearer something"
            },
            "RequestURL": "https://api.imgur.com/3/image",
            "FileFormName": "image",
            "Arguments": {
                "type": "file"
            },
            "ResponseType": "Text",
            "URL": "$json:data.link$",
            "DeletionURL": "https://imgur.com/delete/$json:data.deletehash$"
        },

this works fine, however the access token will expire after about 1 month and you will need to repeat the procedure to acquire a new one.

this will be fixed when proper OAuth handling is implemented.

Example: upload to OwnCloud webdav

the default config file already has an example that uploads to the demo instance

all you have to do is change username, password and url

        {
            "Name": "owncloud (demo)",
            "RequestType": "PUT",
            "RequestURL": "https://demo.owncloud.org/remote.php/webdav/$Y$-$M$-$D$_$h$-$m$-$s$_$n$$extension$",
            "Username": "test",
            "Password": "test",
            "ResponseType": "RedirectionURL"
        }

The URLs don't persist in the clipboard!

First of all, make sure you have a clipboard manager installed and started, such as parcellite or clipmenu . On linux, the clipboard will only persist if there's a clipboard daemon grabbing all newly copied data.

If you're running sharenix without a notification, it will hang for a couple seconds to make sure that a clipboard manager can have a chance to grab the URL. If you don't like the defaults, you can adjust it in sharenix.json by changing ClipboardTime . This value is in seconds and can be fractional.

If you don't want to use a clipboard manager or all else fails, you can pipe the URL into xclip or anything else like so:

$ sharenix -q -c=0 /path/to/my/file | xclip -i -sel cli

xclip will fork into a background process to keep the URL around until something grabs ownership of it.

Customize archive folder

sharenix.json contains a SaveFolder field which is relative to your home folder. that's the base folder for your archived files and history csv which defaults to "sharenix"

if SaveFolder starts with a leading "/" it will be considered an absolute path

you can also enable "OrganizedFolders" which will organize your files into folders for each month named like "2019-02"

Plugins

Sharenix has a very early form of plugins as of 0.3.0a. Feel free to contact me if you wrote a plugin and want it in this list, but be advised that the plugin specification is still subject to changes.

Using a Plugin

Plugins come as one executable but might also include some extra files.

Plugin authors are highly advised to provide specific install instructions for their plugin. I will however provide generic guidelines in this section that will usually apply to every plugin to a certain extent.

To install a plugin, all you have to do is copy all the plugin's files to ~/sharenix/plugins. If the plugins directory doesn't exist, create it.

The plugin authors should always provide an example sharenix.json config entry, or at least a list of parameters you can use. For a generic example of a config entry, see the last step of "Writing a Plugin".

Writing a Plugin

Sharenix has a very early and basic plugin system that might be subject to changes as the development progress.

  • Each plugin is a stand-alone executable that will be placed in the ~/sharenix/plugins directory.

  • The last line of the combined stdout & stderr output is used and parsed as the plugin's output.

  • Command-line parameters must be go-style.

  • The plugin will recieve the sharenix.json Arguments list as command-line parameters. Additionally, a special _tail parameter can be used to append anonymous arguments at the end of the argument list.

  • The sharenix.json config entry should have this format:

      {
          "Name": "My Awesome Plugin!",
          "RequestType": "PLUGIN",
          "RequestURL": "executable-name",
          "FileFormName": "",
          "Arguments": {
              "_tail": "$input$",
              "foo": "bar",
              "someflag": "true"
          },
          "ResponseType": "Text",
          "RegexList": [],
          "URL": "",
          "ThumbnailURL": "",
          "DeletionURL": ""
      },
    

    which will call executable-name like so:

    executable-name -foo=bar -someflag=true /path/to/file or http://url/to/shorten
    

I am well aware that this plugin system lacks security, but defending yourself from malicious plugins is not hard. Avoid non-opensource plugins at all costs and if in doubt, ask someone to check a plugin's code or check it yourself.

Documentation

To see a list of the available options, run ./sharenix -h

You can get the code documentation with the built-in godoc

godoc github.com/Francesco149/sharenix

If you're looking for a specific function or type just use

godoc github.com/Francesco149/sharenix MyFunction

More Repositories

1

weebp

free and open-source wallpaper engine, set any window as your wallpaper
C
548
star
2

oppai-ng

difficulty and pp calculator for osu!. better, smaller, faster rewrite of https://github.com/Francesco149/oppai
C
156
star
3

protonfit

automate installing/running fitgirl repacks on linux with proton. can also be used as a steam-less proton launcher
Shell
124
star
4

oppai

legacy version of my osu! pp calculator. the newer, better version can be found here https://github.com/Francesco149/oppai-ng
C++
102
star
5

nolibc-httpd

1kb single-page http server, static binary for linux x86_64
Assembly
101
star
6

markov.sh

markov chains in ~20 lines of sh, grep, cut and awk
Shell
54
star
7

reversing-sifas

information about love live all stars internals
44
star
8

uwpinject

dll injector for uwp apps
C
36
star
9

templeos-on-bare-metal

installing TempleOS on bare-metal, dual booting with linux and moving it to other machines without a dvd drive
36
star
10

TempleOSGit

archive of HOPPY,J OS,LoseThos, SparrowOS,TempleOS exported as formatted plaintext (Personal branches are my own, not part of the archive)
HolyC
34
star
11

AnimuEyes

procedural anime eyes shader for godot
GLSL
33
star
12

stupidlayers

simple low latency keyboard rebinding/hotkeys for linux using evdev and uinput + example motospeed ck62 binds
C
30
star
13

bdf2x

pixel-perfect upscale bdf bitmap fonts
C
29
star
14

kouta

gameboy emulator in c89
C
28
star
15

linux-osu

personal script that sets up low latency osu! on linux for alsa and pulseaudio
Shell
27
star
16

ojsama

pure javascript implementation of https://github.com/Francesco149/oppai-ng
JavaScript
26
star
17

docker-msvc

a visual c++ 2017 build tools environment for docker
25
star
18

hnng-moe

Source code for hnng.moe
PHP
25
star
19

jniproxy

ARM and x86 hooking framework for love live school idol festival EN and JP
C
24
star
20

baremetal-x86

commented bare-metal x86 examples I wrote while learning
Assembly
24
star
21

fuckcaptcha

bypass reCAPTCHA detection in pyppeteer
Python
22
star
22

q3playground

quake 3 bsp renderer in c89 and opengl 1.x
C
22
star
23

uwpspy

dll that hooks various uwp interfaces for debugging and reverse engineering
C++
22
star
24

reversing-fgo

information about fate grand order internals
20
star
25

pyttanko

osu! pp and difficulty calculator, pure python implementation of https://github.com/Francesco149/oppai-ng
Python
20
star
26

gopher

new gopherspace, will be mostly programming/tech writeups
16
star
27

push_receiver

subscribe to GCM/FCM and receive notifications in python 2/3
Python
16
star
28

todokete

headless client for love live school idol festival all stars + web ui
Kotlin
14
star
29

nolibc

Collection of libc-free C snippets that I paste and tweak in my projects
C
14
star
30

klbvfs

reads encrypted love live all stars databases
Python
13
star
31

WeebCore

(work in progress) single header platform layer and game dev library, public domain
C
13
star
32

stubgen

Portable Windows DLL stub generator. Currently supports Windows and Linux.
C
13
star
33

koohii

osu! pp and difficulty calculator, pure java implementation of https://github.com/Francesco149/oppai-ng
Java
12
star
34

sniffas

logs love live all stars (SIFAS) http traffic through a stub library
C
12
star
35

libmfao

memory scanning library for linux and *nixes with /proc/pid/mem and /proc/pid/maps
C
12
star
36

liboli

personal single-header c89 library with misc utilities (I actually made this just so that I can add -loli to ldflags)
C
12
star
37

nier_uncapped

FPS uncapper for NieR: Automata
C
10
star
38

fgohook

logs fate grand order HTTP traffic through a stub library
C
10
star
39

gachanator

extensible gacha game headless client/swiss-knife library
Python
10
star
40

apk_yoink

download android apks (including region locked ones) from the command line
Python
9
star
41

www.sh

http server in sh using busybox netcat with groff support
Shell
8
star
42

dotemacs

my emacs config
Emacs Lisp
8
star
43

2xProTamsyn

ProFont-11 2x upscaled with a couple extra glyphs taken from Tamsyn
7
star
44

sw_wall

basic doom-style 3D demo in pure software rendering in < 400 LOC
C
7
star
45

android-kotlin-template

sane template to write android apps in kotlin from the terminal without ever touching xml's
Shell
7
star
46

Francesco149.github.io

music visualizer using webaudio api and some manual 3D rendering on a 2D canvas
JavaScript
7
star
47

tinynx

a pure C89 single-file implementation of the nx format for maplestory
C
7
star
48

shigebot.sh

twitch irc bot and irc-ifier in sh
Shell
7
star
49

mapleguide

(WORK IN PROGRESS) guide to all the core MapleStory systems
7
star
50

hoarder

various scripts I use to automate my data hoarding
Shell
6
star
51

sharpx

C# implementation of thebennybox's software renderer in < 1000 LOC
C#
6
star
52

arrow-hell

game of life implemented only using lambdas
JavaScript
6
star
53

dc_demos

various dreamcast demos and tools I wrote while experimenting with the platform
C
6
star
54

sm64pc_instructions

how to compile the unofficial sm64 pc port on windows and linux
6
star
55

docker-dots

(personal config) dockerfile as a whole-system configuration
Shell
6
star
56

fizzlefade.sh

fizzlefade effect from wolfenstein 3d implemented in sh
Shell
5
star
57

android-java-template

sane template to write android apps in java from the terminal without ever touching xml's
Shell
5
star
58

namae-async

tiny async-oriented dns client
C
5
star
59

loli-overlay

personal gentoo overlay
Shell
5
star
60

unlicenser

simple script to generate UNLICENSE contributor agreement/guidelines
Shell
5
star
61

go-hachi

A CHIP-8 emulator written in go.
Go
5
star
62

lolic

(WIP) prototype of my C dialect and its compiler
C
5
star
63

steam-linux-workarounds

works around various issues with steam and other programs running over nfs or trying to access a >2TB drive.
C
4
star
64

vimpls

broadcast commands to all running vim instances on linux
C
4
star
65

startix

automatically install artix linux with a basic dwm desktop
Shell
4
star
66

weeb

Mirrors gopher content over http. Written in C without the standard C library. Powers http://weeb.ddns.net/
C
4
star
67

McBuild

linux build scripts for McOsu and McEngine based projects, with patches for relocatable data dirs
Nix
4
star
68

vfio-setup

my low latency pure qemu vfio setup
Shell
4
star
69

flake

fell for the nix meme // personal nix flake
Nix
4
star
70

gweet

A sharenix plugin that uploads images and videos to twitter.
Go
3
star
71

9readjpg

glibc standalone port of plan9's/9front's readjpg decoder
C
3
star
72

nand

my exploration of combinatory logic, in particular building computers out of NAND gates
Python
3
star
73

windots

personal windows scripts (mainly powershell)
PowerShell
3
star
74

Francesco149

dummy repo for github's banner thingy
3
star
75

dotfiles

anything that I couldn't fit into https://github.com/Francesco149/loli-overlay/tree/master/sys-config/loli
JavaScript
3
star
76

nxfs

fuse filesystem for the .nx maplestory format
C
3
star
77

disasm.sh

live disassembler in vim similar to compiler explorer
Shell
3
star
78

shigebot

A basic twitch IRC bot written in Go.
Go
3
star
79

llsif_launcher

A launcher for School Idol Festival (android version) that allows you to easily manage your multiple accounts and log into the game with one of your accounts in a single click.
C
3
star
80

tos-tools

a big mess of scripts I used to archive TempleOS
C++
3
star
81

surf

personal fork of suckless surf
C
2
star
82

siftools

android shell utilities for love live school idol festival
Shell
2
star
83

uwp-template

sane template to develop and deploy uwp dx11 c++ apps from the command line without ever touching visual studio
C++
2
star
84

jsonpath

(NOT MY CODE) backup of defunct repo NodePrime/jsonpath
Go
1
star
85

MacQutebrowser

wrapper for qutebrowser on macOS 10.10+
Swift
1
star
86

dmenu

personal fork of suckless dmenu
C
1
star
87

dwm

personal dwm customizations
C
1
star
88

homebrew-tap

personal homebrew tap
Ruby
1
star
89

gma4500-gaming

performance info and tweaks for games on intel gma4500/G45 integrated graphics
1
star
90

servo-embedding-example

servo embedding example to be used as a base for a future servo front-end
Rust
1
star
91

stackdl

sh script to download stuff from stackstorage.com
Shell
1
star