// Copyright (c) 2026 Build Your Future. All rights reserved. // Published only so anyone can check that it is safe. This is NOT open source: no license is granted // to copy, modify, reuse or redistribute it. Terms: https://buildyourfuture.fit/eula.html // // Build Your Future Installer // A small desktop app: shows your iPhone, how many days the app has left, the installed vs newest version, // and refreshes it (auto-refresh when you plug in, or with 1 day left). // Signing + installing is done by the bundled engine (plumesign, from the open-source Impactor project, MIT): // you log in with your Apple ID once inside this window; the engine checks it with Apple and saves it on this PC. // // Two modes, same program: // - personal: next to update-ipa.ps1 (the creator's PC). Installs the admin IPA from ipa-branch\. // - public: anywhere else. Downloads the normal IPA from https://buildyourfuture.fit. // // Build: see build.ps1 (uses the C# compiler that comes with Windows / .NET Framework 4). using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Management; using System.Net; using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Web.Script.Serialization; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Windows.Threading; using Forms = System.Windows.Forms; using Drawing = System.Drawing; // Shown in Windows under the file's Properties > Details. [assembly: System.Reflection.AssemblyTitle("Build Your Future Installer")] [assembly: System.Reflection.AssemblyProduct("Build Your Future")] [assembly: System.Reflection.AssemblyCompany("Build Your Future")] [assembly: System.Reflection.AssemblyCopyright("Copyright (c) 2026 Build Your Future. All rights reserved.")] [assembly: System.Reflection.AssemblyTrademark("Build Your Future, Brick By Brick")] [assembly: System.Reflection.AssemblyVersion("1.4.0.0")] [assembly: System.Reflection.AssemblyFileVersion("1.4.0.0")] namespace BuildYourFuture { static class Program { [STAThread] static int Main(string[] args) { bool tray = args.Any(a => a.Equals("-Tray", StringComparison.OrdinalIgnoreCase) || a.Equals("--tray", StringComparison.OrdinalIgnoreCase)); bool createdNew; var mutex = new Mutex(true, @"Local\BuildYourFutureInstaller", out createdNew); var showSignal = new EventWaitHandle(false, EventResetMode.AutoReset, @"Local\BuildYourFutureInstallerShow"); if (!createdNew) { showSignal.Set(); return 0; } var app = new Application(); app.ShutdownMode = ShutdownMode.OnExplicitShutdown; var installer = new Installer(showSignal, tray); installer.Start(); app.Run(); GC.KeepAlive(mutex); return 0; } } class Installer { const string BundleId = "com.workingtheproblem.selfimprovement"; const string WebsiteBase = "https://buildyourfuture.fit/"; const string AppleInfoUrl = "https://developer.apple.com/support/compare-memberships/"; const int ValidDays = 7; readonly EventWaitHandle showSignal; readonly bool startInTray; readonly string root, dataDir, ipaDir, workDir, engine, stateFile, settingsFile, logFile, logoPath, icoPath; readonly bool personal; readonly JavaScriptSerializer json = new JavaScriptSerializer(); Window win; TextBlock subtitle, deviceTitle, deviceSub, daysNumber, daysLabel, daysSub, versionInstalled, versionNewest, versionBadgeText; TextBlock accountText, statusText, footer, autoSub; Ellipse deviceDot; Border daysBar, versionBadge; Button minBtn, closeBtn, loginBtn, loginGoBtn, refreshBtn; StackPanel loginForm, codePanel; TextBox emailBox, codeBox; PasswordBox passwordBox; CheckBox autoSwitch; Hyperlink appleLink; Forms.NotifyIcon trayIcon; DispatcherTimer pollTimer, workTimer; string phase = "idle"; // idle, countdown, update, installing, login string loginStage = "creds"; // creds, wait, code, checking int count; string udid; List known = new List(); string account = ""; string version = ""; DateTime started = DateTime.Now; DateTime lastAutoAttempt = DateTime.MinValue; bool quietRefresh; const int OpenAtDaysLeft = 3; // the window only pops up by itself when this few days are left DateTime lastRemoteCheck = DateTime.Now; bool quitting; Process proc; readonly StringBuilder procOut = new StringBuilder(); volatile bool downloadDone; volatile string downloadError; DateTime updaterLogStamp; public Installer(EventWaitHandle showSignal, bool tray) { this.showSignal = showSignal; this.startInTray = tray; root = AppDomain.CurrentDomain.BaseDirectory; personal = File.Exists(System.IO.Path.Combine(root, "update-ipa.ps1")); dataDir = personal ? root : System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "BuildYourFutureInstaller"); ipaDir = personal ? System.IO.Path.Combine(root, "ipa-branch") : System.IO.Path.Combine(dataDir, "download"); workDir = System.IO.Path.Combine(dataDir, "refresh-work"); engine = System.IO.Path.Combine(root, "engine", "plumesign.exe"); stateFile = System.IO.Path.Combine(dataDir, "iphone-state.json"); settingsFile = System.IO.Path.Combine(dataDir, "installer-settings.json"); logFile = System.IO.Path.Combine(dataDir, "iphone-helper.log"); icoPath = System.IO.Path.Combine(root, "installer.ico"); logoPath = new[] { System.IO.Path.Combine(root, "icon.png"), System.IO.Path.Combine(root, "site", "icon.png") }.FirstOrDefault(File.Exists); Directory.CreateDirectory(dataDir); Directory.CreateDirectory(workDir); Directory.CreateDirectory(ipaDir); } // ---------------------------------------------------------------- setup public void Start() { using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("window.xaml")) { win = (Window)XamlReader.Load(s); } subtitle = Find("Subtitle"); deviceDot = Find("DeviceDot"); deviceTitle = Find("DeviceTitle"); deviceSub = Find("DeviceSub"); daysNumber = Find("DaysNumber"); daysLabel = Find("DaysLabel"); daysSub = Find("DaysSub"); daysBar = Find("DaysBar"); versionInstalled = Find("VersionInstalled"); versionNewest = Find("VersionNewest"); versionBadge = Find("VersionBadge"); versionBadgeText = Find("VersionBadgeText"); accountText = Find("AccountText"); loginBtn = Find