colinlienard / gitlight

🐙 GitHub & GitLab notifications on your desktop
https://gitlight.app
MIT License
762 stars 33 forks source link

GitHub login broken within standalone Tauri build #249

Closed orsonteodoro closed 11 months ago

orsonteodoro commented 11 months ago

It will spawn the webkit-gtk processes, but doesn't show the github login page inside the standalone. 0.15.3, 0.16.0 are broken.

Steps to reproduce Create a new Linux account Run X Run term sudo installed rust-1.73.0, cargo-1.73.0, nodejs-18.16.0, npm, webkit-gtk-2.43.2 with 4.0 API (unstable-tested) webkit-gtk-2.42.4 with 4.0 API (stable-tested), librsvg-2.56.3, gtk-3.24.38... Download source tarball Unpack tarball cd into tarball Updated credentials in .env (AUTH_GITHUB_ID="redacted", AUTH_GITHUB_SECRET="redacted", AUTH_GITLAB_ID="redacted", AUTH_GITLAB_SECRET="redacted", AUTH_SECRET="redacted", PUBLIC_SITE_URL="", TAURI_PRIVATE_KEY="" TAURI_KEY_PASSWORD="") Edited src-tauri/tauri.conf.json to use npm instead of pnpm npm install --legacy-peer-deps npm run build npm run build:tauri --release sudo killall -9 node src-tauri/target/release/git-light

The npm run preview works.

colinlienard commented 11 months ago

Hello Why do you want to npm install with --legacy-peer-deps? Also I don't see a release arg for the tauri build command (see the docs) What do you mean exactly by "doesn't show the github login page"?

orsonteodoro commented 11 months ago

npm install --legacy-peer-deps fixes:

 * Running: npm install --prefer-offline
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @sveltejs/kit@1.30.3
npm ERR! Found: vite@5.0.10
npm ERR! node_modules/vite
npm ERR!   dev vite@"^5.0.2" from the root project
npm ERR!   peerOptional vite@"^3.0.0 || ^4.0.0 || ^5.0.0" from vitefu@0.2.5
npm ERR!   node_modules/vitefu
npm ERR!     vitefu@"^0.2.4" from @sveltejs/vite-plugin-svelte@2.5.3
npm ERR!     node_modules/@sveltejs/vite-plugin-svelte
npm ERR!       @sveltejs/vite-plugin-svelte@"^2.5.0" from @sveltejs/kit@1.30.3
npm ERR!       node_modules/@sveltejs/kit
npm ERR!         dev @sveltejs/kit@"^1.27.6" from the root project
npm ERR!         2 more (@sveltejs/adapter-static, @sveltejs/adapter-vercel)
npm ERR!       1 more (@sveltejs/vite-plugin-svelte-inspector)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^4.0.0" from @sveltejs/kit@1.30.3
npm ERR! node_modules/@sveltejs/kit
npm ERR!   dev @sveltejs/kit@"^1.27.6" from the root project
npm ERR!   peer @sveltejs/kit@"^1.5.0" from @sveltejs/adapter-static@2.0.3
npm ERR!   node_modules/@sveltejs/adapter-static
npm ERR!     dev @sveltejs/adapter-static@"^2.0.3" from the root project
npm ERR!   1 more (@sveltejs/adapter-vercel)
npm ERR! 
npm ERR! Conflicting peer dependency: vite@4.5.1
npm ERR! node_modules/vite
npm ERR!   peer vite@"^4.0.0" from @sveltejs/kit@1.30.3
npm ERR!   node_modules/@sveltejs/kit
npm ERR!     dev @sveltejs/kit@"^1.27.6" from the root project
npm ERR!     peer @sveltejs/kit@"^1.5.0" from @sveltejs/adapter-static@2.0.3
npm ERR!     node_modules/@sveltejs/adapter-static
npm ERR!       dev @sveltejs/adapter-static@"^2.0.3" from the root project
npm ERR!     1 more (@sveltejs/adapter-vercel)
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /var/tmp/portage/dev-util/gitlight-0.16.0/homedir/.npm/_logs/2023-12-19T18_08_58_091Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /var/tmp/portage/dev-util/gitlight-0.16.0/homedir/.npm/_logs/2023-12-19T18_08_58_091Z-debug-0.log

The --release/--debug flag controls selection of build in src-tauri/tauri.conf.json. --debug picks devPath. --release picks distDir.

The login page is presented immediately after you click the "Log in to GitHub" button in the npm run preview version. Using npm run preview I deleted all cookies on Firefox Click "or use the browser" button from http://localhost:5173/ Click "Log in to GitHub" button from http://localhost:5173/login It sends me to "Sign in to GitHub" from https://github.com/login to authorize the app.

colinlienard commented 11 months ago

When using a tauri production build, the login system differs a bit, it should open your navigator where you can login to github, and you should be then prompted to reopen the app thanks to a deeplink. Do you have correctly set the PUBLIC_SITE_URL env variable?

orsonteodoro commented 11 months ago

I did several possibilities. PUBLIC_SITE_URL="" and PUBLIC_SITE_URL="http://localhost:5173" and with and without vite.

Most outcomes resulted in nothing. Clicking the "Log in to GitHub" did nothing but spawn webkit-gtk processes without no UI form or changes.

Only with --debug [I think], the PUBLIC_SITE_URL="http://localhost:5173" resulted in git-light [tauri app] opening Firefox with http://localhost:5173/auth/github/login?from_app=true. If vite server off, the Firefox page is blank. If vite server on, git-light will open Firefox and will show content in Firefox. Then, after authorization it will try to communicate with vite then open up a second instance of git-light while stuck on http://localhost:5173/login in git-light (tauri + webkit-gtk). If you close all instances it bring it back into "Log in to GitHub" loop.

The .env was shred after the build but still works with the npm run preview (browser+vite workflow).

colinlienard commented 11 months ago

I honestly never tested it on linux so I don't know what to tell you, and also I'm not sure what you mean by "communicating with vite" Maybe try to add logs in the frontend, for example in src/routes/(app)/+layout.svelte to check if the deeplink with params works Btw why do you want to build the app? For developing pnpm dev:tauri should work fine

orsonteodoro commented 11 months ago

"communicating with vite" means after GitHub authorization. It should display the redirect page for 1-3 seconds. After that, it should will open and show http://localhost:5173/dashboard. It doesn't do that on the Tauri standalone.

Gentoo Linux users almost build everything from source code for customization and performance reasons. I tried the deb tarball, and it requires OpenSSL 1.1 that is not compatible with 3.0 which is the default on this distribution.

It has the same problem with entirely pnpm build with PUBLIC_SITE_URL="http://localhost:5173/". Is the software supposed to be two packages as in server client? When I tried the pnpm build with an old vite server still on, it got stuck in the please wait stage before loading the dashboard.

colinlienard commented 11 months ago

Sorry but I don't know how to help you

If you just want to use the app you wouldd be better off installing it the normal way: https://gitlight.app/download/linux