Sidekick icon indicating copy to clipboard operation
Sidekick copied to clipboard

Linux support through a web app / or better

Open leMicin opened this issue 1 year ago • 12 comments

Disclaimer

This is probably not coming soon, but we will start dumping information and ideas about the eventual support.

Task list

The following task list is probably not complete and we will update it as tasks are discovered and completed.

  • [ ] Create a Linux specific project (Sidekick.Linux or Sidekick.Tauri)
  • [ ] Implement platform specific services
    • [ ] ITrayProvider (Sidekick.Linux)
    • [ ] IViewLocator (Sidekick.Linux)
    • [ ] IApplicationService (Sidekick.Linux)
    • [ ] IProcessProvider (Sidekick.Common.Platform)
  • [ ] Use cross platform services for Linux. These services are already used in Windows and should be cross platform already
    • [ ] IKeyboardProvider for keybinds
    • [ ] IClipboardProvider for access to the clipboard.
  • [ ] Tauri (One option)
    • [ ] Call rust from the CSharp project to open the tauri view (in the IViewLocator implementation)
  • [ ] Workflow update
    • [ ] Add linux workflow steps to build new packages
    • [ ] Add linux packages to assets
  • [ ] Website update
    • [ ] Update information about where logs and settings are stored on different platforms ENM: System.Environment.SpecialFolder.ApplicationData WIN: C:\Users\xxx\AppData\Roaming LIN: /home/xxx/.config OSX: /Users/xxx/.config

leMicin avatar Dec 18 '24 20:12 leMicin

what do you need ?

jeagerx avatar Dec 19 '24 17:12 jeagerx

We have a .Web project that we use for mainly development. We would need to make an easy to install package from the .Web project.

  • Simplify the setup process
  • It is fine if it opens a console window
  • Open an initial webpage to the configured localhost: port
  • Cleanup the initial home screen and improve navigation

Haven't put too much thought yet. If there were an easy to use package, either through a publish profile or build profile, I could then start cleaning it up a little and producing the desired package with each release.

Any help is welcome, and would make this move faster for sure.

leMicin avatar Dec 19 '24 21:12 leMicin

From a Discord comment: Use https://github.com/webview/webview instead of a full-blown browser. it also uses xdotools to move the window to the mouse afterwards, make it always-on-top, and handles the startup of the webserver

leMicin avatar Dec 20 '24 17:12 leMicin

As writed on discord, it's working for me on Fedora sudo dnf install -y npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0

Get lastest source, edit Sidekick.sln and comment those 2 lines :

#Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Wpf", "src\Sidekick.Wpf\Sidekick.Wpf.csproj", "{0E8A5165-AFEE-42BB-9C96-EA288F613BDE}"
#EndProject

Run

dotnet build
dotnet ./src/Sidekick.Web/bin/Debug/net8.0/Sidekick.dll
firefox localhost:5000

jeagerx avatar Dec 20 '24 18:12 jeagerx

Nice library for a potential cross platform wrapper for Blazor: https://github.com/JinShil/BlazorWebView

leMicin avatar Dec 22 '24 05:12 leMicin

As writed on discord, it's working for me on Fedora sudo dnf install -y npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0

Get lastest source, edit Sidekick.sln and comment those 2 lines :

#Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Wpf", "src\Sidekick.Wpf\Sidekick.Wpf.csproj", "{0E8A5165-AFEE-42BB-9C96-EA288F613BDE}"
#EndProject

Run

dotnet build
dotnet ./src/Sidekick.Web/bin/Debug/net8.0/Sidekick.dll && firefox localhost:5000

I followed all the steps on Arch Linux and was able to run the application. However, the static files (for rendering) did not load, and I received the following warning:

warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16]
      The WebRootPath was not found: /tmp/Sidekick/wwwroot. Static files may be unavailable.

image

veschin avatar Dec 22 '24 14:12 veschin

As writed on discord, it's working for me on Fedora sudo dnf install -y npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0 Get lastest source, edit Sidekick.sln and comment those 2 lines :

#Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Wpf", "src\Sidekick.Wpf\Sidekick.Wpf.csproj", "{0E8A5165-AFEE-42BB-9C96-EA288F613BDE}"
#EndProject

Run

dotnet build
dotnet ./src/Sidekick.Web/bin/Debug/net8.0/Sidekick.dll && firefox localhost:5000

I followed all the steps on Arch Linux and was able to run the application. However, the static files (for rendering) did not load, and I received the following warning:

warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16]
      The WebRootPath was not found: /tmp/Sidekick/wwwroot. Static files may be unavailable.

image

my bad, after build needed to run:

cd src/Sidekick.Web/
dotnet ./bin/Debug/net8.0/Sidekick.dll

And now everything works as expected. image

I found the required sequence of actions here: https://discord.com/channels/664252463188279300/1316628179217027133/1317626241674641491

veschin avatar Dec 22 '24 14:12 veschin

Its doesnt like the oneliner

jeagerx avatar Dec 22 '24 16:12 jeagerx

I wrote a bash script which searches for items in the default browser. Can be bound to any hotkey.

Server needs to be running already, and this assumes you are on wayland and have wl-clipboard and xdotool installed.

#!/bin/bash
# Copy to clipboard and search in Sidekick

original_clip=$(wl-paste) # store what's currently on the clipboard
xdotool keydown ctrl key c keyup ctrl # type ctrl + c in game window using xdotool because proton uses xwayland
sleep 0.1 # sleep for reasons
new_clip=$(wl-paste)

# Check if we copied an item, then encode it to base64
if [[ $new_clip == *"Item Class"* ]] ; then
  encoded_clip=$(echo -n "$new_clip" | base64) 
  xdg-open "http://localhost:5000/trade/xurl_${encoded_clip}" # search for the item in browser
else
  echo "Did not detect an item from PoE2"
fi

echo -n "$original_clip" | wl-copy # restore clipboard

dotaxis avatar Dec 25 '24 09:12 dotaxis

Massive progress made by @dotaxis on a script/tool that opens the Sidekick web app automatically. https://github.com/dotaxis/rs-sidekick-helper

leMicin avatar Dec 26 '24 05:12 leMicin

Any chance we could get the address/port exposed? I don't want to run this directly on my Linux machine, but would rather containerize the web server portions and the networking involved there requires opening it up beyond binding the socket on localhost only.

I don't know C# very well or Blazor at all, or I'd just go implement that myself. Easier to ask and hope :smile:

solacelost avatar Jan 01 '25 21:01 solacelost

This works well for me, btw. Should be able to use Docker or Podman or whatever to build. I run with -p 5000:5000 -v sidekick-data:/app/Sidekick/src/Sidekick.Web/sidekick args.

FROM registry.fedoraproject.org/fedora:41

RUN dnf -y install npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0 git && \
    dnf -y clean all

USER 1001

WORKDIR /app

ENV HOME=/app

RUN git clone https://github.com/Sidekick-Poe/Sidekick.git && \
    cd Sidekick && \
    sed -i '/Sidekick.Wpf/,+1d' Sidekick.sln && \
    dotnet build

WORKDIR /app/Sidekick/src/Sidekick.Web

VOLUME /app/Sidekick/src/Sidekick.Web/sidekick

EXPOSE 5000
ENTRYPOINT ["/usr/bin/dotnet"]
CMD ["bin/Debug/net8.0/Sidekick.dll", "--urls", "http://*:5000"]

solacelost avatar Jan 19 '25 14:01 solacelost

Done with PRs #710 and #707.

domialex avatar May 23 '25 20:05 domialex