Git Product home page Git Product logo

cli's People

Contributors

15cm avatar avnercohen avatar chenrui333 avatar dcsunset avatar dreamsvoid avatar eternal-flame-ad avatar jmattheis avatar rorpage avatar scottwallacesh avatar stewartthomson avatar tessus avatar tohn avatar z-nexx 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

unknown error (status 500): {resp:0x40007b6000}

Hello,
i get this error unknown error (status 500): {resp:0x40007b6000} when i run any of the following commands:

echo "✓" | gotify push
echo '✓' | gotify push
echo ✓ | gotify push

What is the right syntax to push a message which includes the symbol above?

Default priority

Could you add an option to set the default message priority in the cli.json file?

Default priority set in cli.json is ignored

/etc/gotify/cli.json

{
  "token": "XXXXXXXXXXXXXXX",
  "url": "http://127.0.0.1:8057",
  "defaultPriority": 10
}

When I call gotify-cli push -t "title" "message", the notification successfully gets pushed and received, but the priority is 0.
I restarted the server (systemctl restart gotify-server) to hopefully make it re-read the config file, but it makes no difference. /etc/gotify/cli.json is the only config file I have.

gotify/server v2.0.18 (archlinux)
gotify/cli v2.1.1 (archlinux)

Invalid

Please delete this. This was not a bug.

bash implementation

I don't know why this script/program is written in GO, so I created a bash-version of this program.

https://github.com/RubenNL/gotify-bash

Would it be possible to have an official version based on bash? Not everyone is able to use the binaries/compile GO on his platform.

URL with localhost doesn't work!

When I tried to configure the CLI to connect to my server running on the same machine, I was unable to configure to connect using the URL "http://localhost:7500", but everything works fine if I tried to connect on "http://192.168.0.100:7500"!
In my browser, testing the WebUI shipped with the server, both URLs works fine!

Error ("http://localhost:7500"):
Post "http://localhost:7500/message": dial tcp: lookup localhost on 192.168.0.1:53: no such host

'192.168.0.1' is the IP address of my access point! I don´t know why the port '53'!

Tested on: Linux EndeavourOS 6.9.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 21 Jun 2024 19:49:19 +0000 x86_64 GNU/Linux

LSB Version:    n/a
Distributor ID: EndeavourOS
Description:    EndeavourOS Linux
Release:        rolling
Codename:       rolling

Thanks

Support watching command output

I think it would be good if we can support watching changes of command output and sending the difference to gotify, similar to the watch command in *nix.

Then, when we want to do something really simple such as watching a change to the return of an api, we can simply do:

$ gotify-cli watch 'curl http://api.example.com/some_data | jq ".something_interesting"'

And them gotify would keep polling the data and send a notification when the output changes.

Is there a way to run command/scripts according to the received messges?

I am curious about if there's a similar program like cli which can watching/waiting the messages, and run commands according to the received messages?

If such a tool exists, can anyone tell me, thanks?
I am hoping to use such a tool to control my raspberryPi Linux to do something according to messages.

CLI report wrong version number

The latest release "2.2.1" show the correct date but the wrong version and commit hash, I found this accidentally trying to create a script to check if a greater version is available.

$ gotify-cli -v
Version:   2.1.1
Commit:    bafdc655d319c3e3a8716efd8da5a15db4bbf096
BuildDate: 2021-12-11-19:22:36

Expected:

$ gotify-cli -v
Version:   2.2.1
Commit:    5714fb3d004271eb18a76456163208d1010e720d
BuildDate: 2021-12-11-19:22:36

Thanks for great work!

Gotify CLI on Termux

I am trying to Run Gotify CLI on Termux Terminal Emulator for Android but Endup with this Below Error while init the CLI

Error: Get https://push.example.com/version: dial tcp: lookup google.com on [::1]:53: read udp [::1]:48773->[::1]:53: read: connection refused

Example of sending image via CLI

Hello, is it possible to send images via gotify cli?

Assuming config file exists.

gotify push --contentType "text/markdown" -t "Image" "https://placekitten.com/400/300"
Thanks?

Redirect sent message to file

Hello,

Is is possible to have the message that's sent to Gotify also saved to a text file?

.\gotify-cli-windows-amd64.exe push "hello" > checkme.txt
> type .\checkme.txt
message created

I would like to have "hello" saved in the text file.

watch without command timeout

sometime it is nice to run a command which is importend to complete, but the next run should not be to wide in the future.

it would be nice, that this command does not cancle on timeout, and the next run should be the interval time after the command complete time.

could we got a flag/option for it? (like --no-timeout)
I like that there is also a timeout option ...

Distribute as a snap?

Hi,

Would you consider distributing this CLI tool as a snap?
This would make it much simpler to install on a bunch of distros, e.g.

snap install gotify-cli
...
gotify-cli push "Hello World"

I've worked out a minimal snapcraft yaml file (assuming it is included in this repo as snap/snapcraft.yaml):

name: gotify-cli
summary: A command line interface for pushing messages to gotify/server.
description: |
  Gotify-CLI is a command line client for pushing messages to gotify/server.

version: git
grade: stable
base: core20

confinement: strict

apps:
  gotify-cli:
    command: bin/cli
    plugs: [network]

parts:
  gotify-cli:
    plugin: go
    source: .

This was enough for me to build it locally, install it and test the init/config/push functionalities. The version command only spits unknowns tho. Furthermore some of the proposed path for the config file are most likely not exposed by default to the snap.

How to use it with multiple applications and users?

Hi

The init seems to recreate the json file. I am wondering if it is possibe to use the cli app with multiple tokens and users easily without entering all those long details ? It works well when there is only one app token.

thanks

Got golang panic when pushing message with --token parameter

I'd like to use gotify-cli in some automatic scripts invoked by some other services. When I tried to make a parameter settings like these and without the cli.json:
gotify-cli push --url http://gotify.xxxxxxxx.com --token someToken messages
I got a golang panic both on Linux and Windows:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xd8ea02]

goroutine 1 [running]:
github.com/gotify/cli/v2/command.doPush(0xc00079e2c0)
        /home/jm/src/gotify/cli/command/push.go:72 +0x342
gopkg.in/urfave/cli%2ev1.HandleAction({0xdc0020, 0xe66ce0}, 0x4)
        /home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:492 +0x7b
gopkg.in/urfave/cli%2ev1.Command.Run({{0xe3fecd, 0x4}, {0x0, 0x0}, {0xc0003f06e0, 0x1, 0x1}, {0xe4573b, 0x10}, {0x0, ...}, ...}, ...)
        /home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/command.go:210 +0x8f8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc00040f1e0, {0xc0000d8000, 0x7, 0x8})
        /home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:255 +0x6ac
main.main()
        /home/jm/src/gotify/cli/cli.go:34 +0xf88

But if I run gotify-cli init or create a cli.json file with same url and token, it works well.

Request for new release

Dear gotify devs,

I appreciate a lot this CLI for gotify and already integrated it for multiple purposes on two servers. I'd love to use the configuration option for the default notification priority, which is not yet available (or fixed) in the current release.
Can you please publish a new release with binaries of the current master so people can receive this feature through the package managers of their OS?
For reference, the need for a new release was mentioned in #36.

Thank you!

./cli.json on windows executable resolves to current working directory instead of path relative to .exe.

After running init and selecting to save the configs to ./cli.json the executable is unable to find the config file unless the console working directory is the executable's directory. In fact, I believe the ./cli.json file is saved to whichever working directory you have active when initis run.

Not sure if this is the intended functionality but I expected it to save to the same directory as the .exe file and to always be loaded from there regardless of my working directory.

As a temporary fix I created a batch script that I am using to call the cli app from anywhere with the expected behavior. I'm posting it here in case anyone finds this thread and needs an immediate fix.

gotify.bat
-----------------
@echo off
pushd %~dp0
Call %~dp0\gotify-cli-windows-amd64.exe p -q %* 
popd

The scripts needs to be placed on the same directory as the executable to work as is.

gotify init skip TLS validation

Currently, it's impossible to use gotify with a server running a self-signed cert.

gotify-cli init
(enter url)
Connecting -> Failed
Error: Get https://myserver.com/version: x509 certificate signed by unknown authority

gotify-cli init needs a flag to allow untrusted certificates.

Why not use this CLI for E2EE

End to end encryption might be rather difficult without some kind of sending client this tool might be ideal. Also, this is a really helpful thing because you can just pipe things to it. Sure you can do that with curl but its way easier with a single binary.

token via env var

If one uses the --token argument, the token shows up in the process list. When I use different scripts on the same machine that use the gotify client, I'd also like to use different tokens in these scripts.

Thus it would be awesome to set a GOTIFY_TOKEN env var in the script and the gotify cli uses the token from the env var.

Any chance that this can be added?

P.S.: I am more than happy to create a PR. I only want to know, whether such a change would be accepted.

Migrate to GitHub Actions

Travis CI hasn't been building for 2 years on this repo so there is no CI happening on this repo for 2 years. Since the server repo has migrated to GitHub Actions we probably should migrate this too.

Feature: New option to push message every x lines(default 1)

I'm watching logs for some filesystems and want notified when there are new entries. I'm using:

`journalctl -kf | xargs -L 1 gotify p

That is working great! I'd like to make it integrated so as to not worry as much about buffering and to not need the xargs and be more portable for others.

Something like:

journalctl -kf | gotify p -L 1

And the option could be:

gotify push 
--lines value, -L value Push a message every 'value' lines (default: 1)

Would this be a good idea?

send with CLI at only one client/user + CLI and letsencrypt-certificate

Hello,
in my test-environment I have 2 clients (smartphones) who logged in with different usernames.
Now I want to send a message over the CLI only to "user1", but I dont know what's the syntax.

And: I have a letsencrypt-certificate. With the smartphone-client I can check on that the client ignore somewhat so he had login correctly. Is this possible with the CLI too?

With best regards,
reschresch

Add `GOTIFY_SKIP_VERIFY_TLS` option to the config file

Would it be possible to add the GOTIFY_SKIP_VERIFY_TLS flag to the configuration file?

{
  "token": "A4ZudDRdLT40L5X",
  "url": "https://gotify.example.com",
  "defaultPriority": 6
  "skipVerifyTls": true
}

This way the whole configuration would reside in one place.

How to insert newlines into text?

Hi, is it possible to insert newline characters into the text that is sent?

I've tried inserting \n in the text - result is it just gets output, eg. gotify push -t "Test" -p 5 "fred\nnurk" gives: fred\nnurk

Also tried setting a variable as newline, eg. nl=$'\n', but this gets transformed into a space, eg. gotify push -t "Test" -p 5 "fred${nl}nurk" gives: fred nurk

TIA

Use the user directory as default config file location

The current default(first) location for configuration storage is ./cli.json, which is not so useful in most cases since the user would need to:

  • Call gotify-cli in this specific directory for every invocation
  • Create a cli.json in a random directory, which is not a clearly explanatory file name.

So I think in most cases, the user would use user directory as their config storage, so we should put that in front of ./cli.json by default during initialization.

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.