Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run client on remote machine? #46

Open
mesb1 opened this issue Jul 14, 2024 · 6 comments
Open

Run client on remote machine? #46

mesb1 opened this issue Jul 14, 2024 · 6 comments

Comments

@mesb1
Copy link

mesb1 commented Jul 14, 2024

Hi.
For a long time i was using oysttyer for twitter posting of musivupdates until api was closed.

Is it possible for your app to login on my local machine and move application to the my remote server for automatic posting?

@mesb1
Copy link
Author

mesb1 commented Jul 14, 2024

Anyway, for the first run i have got bunch of errors:

`
./x auth
panic: exec: "xdg-open": executable file not found in $PATH

goroutine 1 [running]:
github.com/devhindo/x/src/cli/utils.OpenBrowser(...)
/home/devhindo/gh/x/src/cli/utils/open.go:11
github.com/devhindo/x/src/cli/auth.(*User).open_browser_to_auth_url(...)
/home/devhindo/gh/x/src/cli/auth/user.go:45
github.com/devhindo/x/src/cli/auth.Auth()
/home/devhindo/gh/x/src/cli/auth/auth.go:18 +0xd6
github.com/devhindo/x/src/cli/x.HandleArgs()
/home/devhindo/gh/x/src/cli/x/args.go:28 +0x2e5
github.com/devhindo/x/src/cli/x.Run(...)
/home/devhindo/gh/x/src/cli/x/run.go:4
main.main()
/home/devhindo/gh/x/src/cli/main.go:7 +0x10
`

Not sure if it works fine for me.
Also i see no additional options to show additional files placement.
For example -tmpfile key for the .tempxcli file.
As it is not a good idea just to put in a home dir.

@devhindo
Copy link
Owner

Interesting
I never tested it on remote machines, but logging in to your remote machine using SSH is expected to work fine. Can you explain your approach more? for me to be able to test it on my end.

The process is simple. The configuration file is ~/.tempxcli and it's global. You can configure the tool on your local machine until it works fine using x auth and the usual authentication approach written in README, and once it works as you expected you can move the .tempxcli file to the home directory of your remote machine and it's expected to work there, then you can do your automation logic as your need.

For this error you got ./x auth: panic: exec: "xdg-open": executable file not found in $PATH It should pop up the default browser to complete authentication and it seems to not be able to find the default browser. You can always run x auth --url and pull the URL and open it in your browser and complete the authentication process there, and after done you run x auth -v. If anything happens you are welcome to inform. Can you provide the operating system specifications on which this error occurs? So I can debug it and see why it doesn't catch your default browser?

For the additional file placement. The .tempxcli should be handled internally for abstraction purposes. For providing an option to include it, you should know how the tool works internally and I see no need for configuring the .tempxcli yourself as the file is not human readable and if it is manually generated, a space for example could cause many errors.

Also, Excuse my naivety, Where should the config file be located? knowing that the tool is shipped to different major operating systems and I need a global location that is not OS dependent, I'm currently using this. This would be very helpful for future development.

Anyways Thanks for this in-depth error informing ❤️

@mesb1
Copy link
Author

mesb1 commented Jul 18, 2024

Also, Excuse my naivety, Where should the config file be located?

Looks like some misunderstanding, english isn't my native so it might be isn't clear sometimes.
It is ok to use home by default, but please add some option for placing needed config somewhere else.
I will describe my setup and what was comfortable for use.

For example all my service scripts placed under /etc/myscripts
And it is easy to backup, easy to remember where all of the settings stored for this remote machine.
So it would be nice to have an option for using config file not just under home, but where i want it to be.

@mesb1
Copy link
Author

mesb1 commented Jul 18, 2024

From now i deleted all the settings again from twitter and from my remote machine, and what i have got now starting from scratch:

Environment:
Almalinux8 - minimal install, no gui, no browsers.
Just my icecast server and a few scripts as a connections between icecast server and your xcli application.
Not a spam, just a regular account that want's post my own tweets about music is playing.

Logging into remote machine and diong it:

./x auth --url
you are not authenticated | try 'x auth'

At that point i was trying to get auth url for being pasted into my local browser on a personal computer. Gets error.

Ok, now iam trying to run it as usual to get any result, get this error:

./x auth
panic: exec: "xdg-open": executable file not found in $PATH

goroutine 1 [running]:
github.com/devhindo/x/src/cli/utils.OpenBrowser(...)
/home/devhindo/gh/x/src/cli/utils/open.go:11
github.com/devhindo/x/src/cli/auth.(*User).open_browser_to_auth_url(...)
/home/devhindo/gh/x/src/cli/auth/user.go:45
github.com/devhindo/x/src/cli/auth.Auth()
/home/devhindo/gh/x/src/cli/auth/auth.go:18 +0xd6
github.com/devhindo/x/src/cli/x.HandleArgs()
/home/devhindo/gh/x/src/cli/x/args.go:28 +0x2e5
github.com/devhindo/x/src/cli/x.Run(...)
/home/devhindo/gh/x/src/cli/x/run.go:4
main.main()
/home/devhindo/gh/x/src/cli/main.go:7 +0x10

Now i decide to repeat first command and it started working:
./x auth --url
https://twitter.com/blablabla

At this point i have changed twitter to x and confirmed access to my account.
And go back to run this:

./x auth -v
verified. post a tweet like this => x -t "first tweet from terminal!"

At this point we are good.

@mesb1
Copy link
Author

mesb1 commented Jul 18, 2024

Oh, for some reason now it is working again.

./x -t "testing"
tweet posted!

Letme run my scripts that posts about once per 30-50 mins and i will get back.

@devhindo
Copy link
Owner

For example all my service scripts placed under /etc/myscripts And it is easy to backup, easy to remember where all of the settings stored for this remote machine. So it would be nice to have an option for using config file not just under home, but where i want it to be.

That's convincing. I will be adding this in a future release. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants