Compare commits

..

1 Commits

Author SHA1 Message Date
Kevin Yue
69ef7f5cce ci: upload offline tarball 2025-01-22 22:48:30 +08:00
7 changed files with 60 additions and 102 deletions

View File

@@ -44,8 +44,7 @@ jobs:
with: with:
version: 9 version: 9
- name: Prepare workspace - name: Prepare workspace
run: rm -rf source && mkdir -p source/artifacts run: rm -rf source && mkdir source
- name: Checkout GlobalProtect-openconnect - name: Checkout GlobalProtect-openconnect
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@@ -53,7 +52,6 @@ jobs:
repository: yuezk/GlobalProtect-openconnect repository: yuezk/GlobalProtect-openconnect
ref: ${{ github.ref }} ref: ${{ github.ref }}
path: source/gp path: source/gp
- name: Create tarball - name: Create tarball
run: | run: |
cd source/gp cd source/gp
@@ -62,28 +60,13 @@ jobs:
touch SNAPSHOT touch SNAPSHOT
fi fi
make tarball make tarball
mv -v .build/tarball/*.tar.gz ../artifacts/
- name: Generate RPM spec file
env:
RELEASE_TAG: ${{ github.ref == 'refs/heads/dev' && 'snapshot' || github.ref_name }}
run: |
cd source/gp
make init-rpm \
REVISION='1%{?dist}' \
RPM_SOURCE=https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${RELEASE_TAG}/%{name}-%{version}.tar.gz
mv -v .build/rpm/*.spec ../artifacts/
- name: Upload tarball - name: Upload tarball
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: artifact-source name: artifact-source
if-no-files-found: error if-no-files-found: error
path: | path: |
source/artifacts/* source/gp/.build/tarball/*.tar.gz
tarball-offline: tarball-offline:
if: ${{ github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/') }} if: ${{ github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/') }}

1
Cargo.lock generated
View File

@@ -1599,7 +1599,6 @@ dependencies = [
"clap-verbosity-flag", "clap-verbosity-flag",
"dns-lookup", "dns-lookup",
"env_logger", "env_logger",
"gtk",
"log", "log",
"log-reload", "log-reload",
"md5", "md5",

View File

@@ -8,8 +8,6 @@ RUST_VERSION = 1.80
VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version') VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
REVISION ?= 1 REVISION ?= 1
RPM_SOURCE ?= %{name}.tar.gz
PPA_REVISION ?= 1 PPA_REVISION ?= 1
PKG_NAME = globalprotect-openconnect PKG_NAME = globalprotect-openconnect
PKG = $(PKG_NAME)-$(VERSION) PKG = $(PKG_NAME)-$(VERSION)
@@ -236,7 +234,6 @@ init-rpm: clean-rpm
sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.spec sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.spec
sed -i "s/@REVISION@/$(REVISION)/g" .build/rpm/globalprotect-openconnect.spec sed -i "s/@REVISION@/$(REVISION)/g" .build/rpm/globalprotect-openconnect.spec
sed -i "s|@SOURCE@|$(RPM_SOURCE)|g" .build/rpm/globalprotect-openconnect.spec
sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/rpm/globalprotect-openconnect.spec sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/rpm/globalprotect-openconnect.spec
sed -i "s/@DATE@/$(shell LC_ALL=en.US date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec sed -i "s/@DATE@/$(shell LC_ALL=en.US date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec

View File

@@ -39,9 +39,6 @@ clap-verbosity-flag = { workspace = true, optional = true }
env_logger = { workspace = true, optional = true } env_logger = { workspace = true, optional = true }
log-reload = { version = "0.1", optional = true } log-reload = { version = "0.1", optional = true }
[target.'cfg(not(any(target_os="macos", target_os="windows")))'.dependencies]
gtk = "0.18"
[features] [features]
tauri = ["dep:tauri"] tauri = ["dep:tauri"]
clap = ["dep:clap", "dep:clap-verbosity-flag"] clap = ["dep:clap", "dep:clap-verbosity-flag"]

View File

@@ -41,6 +41,12 @@ pub fn patch_gui_runtime_env(hidpi: bool) {
// This is to avoid blank screen on some systems // This is to avoid blank screen on some systems
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1"); std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
// Workaround for https://github.com/tauri-apps/tao/issues/929
let is_wayland = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "wayland";
if is_wayland {
env::set_var("GDK_BACKEND", "x11");
}
if hidpi { if hidpi {
info!("Setting GDK_SCALE=2 and GDK_DPI_SCALE=0.5"); info!("Setting GDK_SCALE=2 and GDK_DPI_SCALE=0.5");
std::env::set_var("GDK_SCALE", "2"); std::env::set_var("GDK_SCALE", "2");

View File

@@ -1,49 +1,26 @@
use std::{process::ExitStatus, time::Duration};
use anyhow::bail;
use log::info;
use tauri::WebviewWindow; use tauri::WebviewWindow;
use tokio::process::Command;
pub trait WindowExt { pub trait WindowExt {
fn raise(&self) -> anyhow::Result<()>; fn raise(&self) -> anyhow::Result<()>;
} }
impl WindowExt for WebviewWindow { impl WindowExt for WebviewWindow {
#[cfg(any(target_os = "macos", target_os = "windows"))]
fn raise(&self) -> anyhow::Result<()> { fn raise(&self) -> anyhow::Result<()> {
self.show()?; raise_window(self)
Ok(())
}
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
fn raise(&self) -> anyhow::Result<()> {
unix::raise_window(self)
} }
} }
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
mod unix {
use std::{process::ExitStatus, time::Duration};
use anyhow::bail;
use gtk::{
glib::Cast,
traits::{EventBoxExt, GtkWindowExt, WidgetExt},
EventBox,
};
use log::info;
use tauri::WebviewWindow;
use tokio::process::Command;
pub fn raise_window(win: &WebviewWindow) -> anyhow::Result<()> { pub fn raise_window(win: &WebviewWindow) -> anyhow::Result<()> {
let is_wayland = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "wayland"; let is_wayland = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "wayland";
if is_wayland { if is_wayland {
let gtk_win = win.gtk_window()?; win.hide()?;
if let Some(header) = gtk_win.titlebar() { win.show()?;
let _ = header.downcast::<EventBox>().map(|event_box| {
event_box.set_above_child(false);
});
}
gtk_win.hide();
gtk_win.show_all();
} else { } else {
if !win.is_visible()? { if !win.is_visible()? {
win.show()?; win.show()?;
@@ -56,7 +33,7 @@ mod unix {
}); });
} }
// Calling window.show() on window object will cause the menu to be shown. // Calling window.show() on Windows will cause the menu to be shown.
// We need to hide it again. // We need to hide it again.
win.hide_menu()?; win.hide_menu()?;
@@ -94,4 +71,3 @@ mod unix {
Ok(exit_status) Ok(exit_status)
} }
}

View File

@@ -6,7 +6,7 @@ Group: Productivity/Networking/PPP
License: GPL-3.0 License: GPL-3.0
URL: https://github.com/yuezk/GlobalProtect-openconnect URL: https://github.com/yuezk/GlobalProtect-openconnect
Source: @SOURCE@ Source: %{name}.tar.gz
BuildRequires: make BuildRequires: make
BuildRequires: rust BuildRequires: rust