Skip to content

Commit

Permalink
Performance Improvements. Updater. Signing.
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Apr 17, 2024
1 parent bfe954e commit eab84db
Show file tree
Hide file tree
Showing 14 changed files with 1,635 additions and 324 deletions.
1,068 changes: 1,053 additions & 15 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ win32job = "2"
parse-display = "0.9"
flume = "0.11"
whoami = "1.5"
anyhow = "1"
semver = "1"
sha2 = "0.10"
reqwest = { version = "0.12", features = ["stream", "json", "blocking"] }
rand = "0.8"
url = { version = "2", features = ["serde"] }


[build-dependencies]
winres = "0.1"
Expand Down
Binary file added certificates/developer_id_Installer.p12
Binary file not shown.
Binary file added certificates/developer_id_app.p12
Binary file not shown.
Binary file added certificates/smartcode-20211118-20241118.pfx
Binary file not shown.
12 changes: 7 additions & 5 deletions setup/Stremio.iss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ WizardImageFile={#SourcePath}..\images\windows-installer.bmp
WizardSmallImageFile={#SourcePath}..\images\windows-installer-header.bmp
SetupIconFile={#SourcePath}..\images\stremio.ico
UninstallDisplayIcon={app}\{#MyAppExeName},0
SignTool=stremiosign
SignedUninstaller=yes

[Code]
function InitializeSetup: Boolean;
Expand Down Expand Up @@ -159,11 +161,11 @@ Name: "assoctorrent"; Description: "Associate {#MyAppName} with .torrent files"

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "{#MyAppExeLocation}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}..\mpv.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}..\bin\ffmpeg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}..\bin\ffprobe.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}..\bin\stremio-runtime.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppExeLocation}"; DestDir: "{app}"; Flags: ignoreversion sign
Source: "{#SourcePath}..\mpv.dll"; DestDir: "{app}"; Flags: ignoreversion sign
Source: "{#SourcePath}..\bin\ffmpeg.exe"; DestDir: "{app}"; Flags: ignoreversion sign
Source: "{#SourcePath}..\bin\ffprobe.exe"; DestDir: "{app}"; Flags: ignoreversion sign
Source: "{#SourcePath}..\bin\stremio-runtime.exe"; DestDir: "{app}"; Flags: ignoreversion sign
Source: "{#SourcePath}..\server.js"; DestDir: "{app}"; Flags: ignoreversion

[Registry]
Expand Down
3 changes: 2 additions & 1 deletion setup/create_setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ if not exist "%mypath%..\target\release\stremio-shell-ng.exe" (
)

:: Compile the installer
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "%mypath%Stremio.iss"
:: "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "%mypath%Stremio.iss"
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "/Sstremiosign=$qC:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe$q sign /f $q${{ github.workspace }}\certificates\smartcode-20211118-20241118.pfx$q /p ${{ secrets.WIN_CERT_PASSWORD }} /v $f" "%mypath%Stremio.iss"
34 changes: 24 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
#![windows_subsystem = "windows"]
#![cfg_attr(all(not(test), not(debug_assertions)), windows_subsystem = "windows")]
#[macro_use]
extern crate bitflags;
use std::io::Write;
use std::path::Path;
use std::process::exit;
use std::{io::Write, path::Path, process::exit};
use url::Url;
use whoami::username;

use clap::Parser;
use native_windows_gui::{self as nwg, NativeUi};
mod stremio_app;
use crate::stremio_app::{stremio_server::StremioServer, MainWindow, PipeClient};

const DEV_ENDPOINT: &str = "http://127.0.0.1:11470";
const WEB_ENDPOINT: &str = "https://app.strem.io/shell-v4.4/";
const STA_ENDPOINT: &str = "https://staging.strem.io/";
use crate::stremio_app::{
constants::{DEV_ENDPOINT, IPC_PATH, STA_ENDPOINT, WEB_ENDPOINT},
stremio_server::StremioServer,
MainWindow, PipeClient,
};

#[derive(Parser, Debug)]
#[clap(version)]
struct Opt {
command: Option<String>,
#[clap(
long,
help = "Start the app only in system tray and keep the window hidden"
)]
start_hidden: bool,
#[clap(long, help = "Enable dev tools when pressing F12")]
dev_tools: bool,
#[clap(long, help = "Disable the server and load the WebUI from localhost")]
Expand All @@ -27,6 +31,12 @@ struct Opt {
staging: bool,
#[clap(long, default_value = WEB_ENDPOINT, help = "Override the WebUI URL")]
webui_url: String,
#[clap(long, help = "Ovveride autoupdater endpoint")]
autoupdater_endpoint: Option<Url>,
#[clap(long, help = "Forces reinstalling current version")]
force_update: bool,
#[clap(long, help = "Check for RC updates")]
release_candidate: bool,
}

fn main() {
Expand Down Expand Up @@ -55,7 +65,7 @@ fn main() {
};

// Single application IPC
let mut commands_path = "//./pipe/com.stremio5.".to_string();
let mut commands_path = IPC_PATH.to_string();
// Append the username so it works per User
commands_path.push_str(&username());
let socket_path = Path::new(&commands_path);
Expand Down Expand Up @@ -83,6 +93,10 @@ fn main() {
commands_path: Some(commands_path),
webui_url,
dev_tools: opt.development || opt.dev_tools,
start_hidden: opt.start_hidden,
autoupdater_endpoint: opt.autoupdater_endpoint,
force_update: opt.force_update,
release_candidate: opt.release_candidate,
..Default::default()
})
.expect("Failed to build UI");
Expand Down
Loading

0 comments on commit eab84db

Please sign in to comment.