Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ cargo test -p starorg-codex-app # gpu, contract and IPC tests (mock runti
app yet ("Nothing was sent"); nothing is faked.
"Check for updates" is built (`src/update/`, [docs/updates.md](../docs/updates.md)): the
GitHub releases list through `starorg-net`, the banner, skip, in-app install via
`tauri-plugin-updater` from Rust (AppImage/NSIS/MSI with a real key). Not built yet, so shown
disabled in Settings and always stored off: "Use published game data". Also not read yet: `safe_gpu`, and
`tauri-plugin-updater` from Rust (AppImage/NSIS/MSI with a real key). "Download published LIVE
builds for Diff" is built (Developer mode's Datasets/Diff only, `contract/real/dev.rs`); apply
never uses published data. Not read yet: `safe_gpu`, and
`discover_installs(deep)` (same scan either way). Running setup again keeps a set-up
channel's profile and setup time; only new channels get the chosen preset.
`cargo test -p starorg-codex-app --test real_backend` runs it against a synthetic install
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/keyboard-wizard.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const { chromium } = require(process.env.PLAYWRIGHT_CORE || 'playwright-core');
console.log('after step2:', await heading());
await pressUntil('Next'); await p.keyboard.press('Enter');
console.log('after step3:', await heading());
await pressUntil('Next'); await p.keyboard.press('Enter');
console.log('after step4:', await heading());
await p.getByText('strings changed').first().waitFor();
await pressUntil('Set up and apply'); await p.keyboard.press('Enter');
await p.getByRole('button', { name: 'Open StarOrg Codex' }).waitFor({ timeout: 10000 });
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/render-wizard.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { chromium } = require(process.env.PLAYWRIGHT_CORE || 'playwright-core');
const OUT = (process.env.RENDER_DIR || require('path').resolve(__dirname, '../../.tmp/renders')) + '/m3-wizard';
const BASE = (process.env.BASE_URL || 'http://127.0.0.1:4317/') + '';
const steps = ['install', 'channels', 'source', 'enhancements', 'prefs', 'review', 'apply'];
const steps = ['install', 'channels', 'enhancements', 'prefs', 'review', 'apply'];
(async () => {
const browser = await chromium.launch({ headless: true });
const errors = [];
Expand Down Expand Up @@ -30,7 +30,7 @@ const steps = ['install', 'channels', 'source', 'enhancements', 'prefs', 'review
await p.locator('#ch-PTU').click();
await p.getByRole('button', { name: /^Next/ }).click();
});
await shot('8-close-guard', '?wizard=source', async (p) => {
await shot('8-close-guard', '?wizard=enhancements', async (p) => {
await p.getByRole('button', { name: /Set up later/ }).click();
await p.getByRole('heading', { name: 'Leave setup for now?' }).waitFor();
});
Expand Down
93 changes: 74 additions & 19 deletions app/src-tauri/src/contract/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ pub enum SourceKind {
Build,
/// A local folder (or one file) of `*.json`.
Folder,
/// A published dump of this exact build (addendum §1).
/// A published LIVE build downloaded for Diff (addendum §1): `dump:<tag>`.
Dump,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum SourceState {
Ready,
/// Needs Settings > Network > "Use published game data".
/// Needs a switch that is off.
Off,
/// Not there (yet): the build's data was not read, the folder is gone.
Missing,
Expand All @@ -192,7 +192,7 @@ pub struct DevDatasetSummary {

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DevSource {
/// `build:<channel>`, `folder:<n>`, `dump:<channel>`.
/// `build:<channel>`, `folder:<n>`, `dump:<tag>`.
pub id: String,
pub kind: SourceKind,
pub label: String,
Expand All @@ -203,6 +203,37 @@ pub struct DevSource {
pub datasets: Vec<DevDatasetSummary>,
}

/// A published LIVE build of `voidput/sc-gamedata-dumps` (addendum §1, Diff only).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DumpRelease {
/// `Data.Version` of the build, e.g. `4.10.200.58746`; its source id is `dump:<tag>`.
pub tag: String,
/// The release title, e.g. `4.10.0 LIVE (4.10.200.58746)`.
pub title: String,
/// Always `LIVE` (only LIVE builds are offered).
pub channel: String,
pub branch: Option<String>,
/// When it was published (RFC 3339).
pub published: Option<String>,
/// Downloaded and on this computer: usable as a source with the switch off too.
pub cached: bool,
}

/// The published LIVE builds as far as they could be listed.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DumpReleases {
pub releases: Vec<DumpRelease>,
/// Set when GitHub could not be asked (offline, rate limited): `releases` then holds only
/// the downloaded builds. Not an error: they still work.
pub error: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DevDumpRequest {
pub target: ChannelRef,
pub tag: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DevSourceRef {
pub target: ChannelRef,
Expand Down Expand Up @@ -455,10 +486,15 @@ pub trait DevBackend {
/// Native folder dialog; at most 5 folders are remembered.
fn dev_add_source(&self, req: ChannelRef) -> CmdResult<Vec<DevSource>>;
fn dev_remove_source(&self, req: DevSourceRef) -> CmdResult<Vec<DevSource>>;
/// `network-off` while "Use published game data" is off.
/// The published LIVE builds, newest first. With "Download published LIVE builds for
/// Diff" off: only the downloaded ones, and no request is made. When GitHub cannot be
/// reached: the downloaded ones with `error` set.
fn dev_dump_releases(&self, req: ChannelRef) -> CmdResult<DumpReleases>;
/// Download, verify and cache one LIVE build (a job); `network-off` while the switch is
/// off. Returns the sources, now with `dump:<tag>`.
fn dev_download_dump(
&self,
req: ChannelRef,
req: DevDumpRequest,
progress: Progress<'_>,
) -> CmdResult<Vec<DevSource>>;
fn dev_dataset(&self, req: DevDatasetRef) -> CmdResult<DatasetInfo>;
Expand All @@ -481,19 +517,37 @@ pub fn disabled() -> AppError {
)
}

/// The refusal both backends give the dump download while it is not built.
pub fn dump_refusal(switch_on: bool) -> AppError {
if switch_on {
AppError::new(
ErrorCode::NotImplemented,
"Published dumps as a dataset source are a follow-up; use This build or a local folder.",
)
} else {
AppError::new(
ErrorCode::NetworkOff,
"Turn on Settings > Network > \"Use published game data\" first.",
)
}
/// The refusal both backends give a dump download while the switch is off.
pub fn dumps_off() -> AppError {
AppError::new(
ErrorCode::NetworkOff,
"Turn on Settings > Network > \"Download published LIVE builds for Diff\" first.",
)
}

/// The answer for an unknown or non-LIVE tag (both backends).
pub fn dump_not_published(tag: &str, why: &str) -> AppError {
AppError::new(
ErrorCode::NotFound,
format!("Could not download {}: {why}", dump_label(tag)),
)
}

/// The answer for a tag that is not one path component (both backends).
pub fn bad_dump_tag(tag: &str) -> AppError {
AppError::new(ErrorCode::Invalid, format!("bad build tag {tag:?}"))
}

/// `dump:<tag>` of a source id, when the tag is usable as one path component.
pub fn dump_tag(source: &str) -> Option<&str> {
source
.strip_prefix("dump:")
.filter(|t| starorg_core::source::dump::valid_component(t))
}

/// The label of a downloaded LIVE build in the source lists.
pub fn dump_label(tag: &str) -> String {
format!("LIVE {tag}")
}

macro_rules! dev_commands {
Expand Down Expand Up @@ -545,6 +599,7 @@ dev_commands! {
dev_sources(req: ChannelRef) -> Vec<DevSource>;
dev_add_source(req: ChannelRef) -> Vec<DevSource>;
dev_remove_source(req: DevSourceRef) -> Vec<DevSource>;
dev_dump_releases(req: ChannelRef) -> DumpReleases;
dev_dataset(req: DevDatasetRef) -> DatasetInfo;
dev_table(req: DevTableRef) -> TableInfo;
dev_rows(req: DevRowsRequest) -> RowsPage;
Expand All @@ -560,7 +615,7 @@ dev_commands! {
dev_progress_commands! {
dev_open(req: ChannelRef) -> DevStatus;
dev_export_type(req: DevExportTypeRequest) -> DevExportResult;
dev_download_dump(req: ChannelRef) -> Vec<DevSource>;
dev_download_dump(req: DevDumpRequest) -> Vec<DevSource>;
dev_diff(req: DevDiffRequest) -> DevDiffSummary;
}

Expand Down
6 changes: 0 additions & 6 deletions app/src-tauri/src/contract/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,12 +1354,6 @@ impl Backend for MockBackend {
counts,
});
}
if req.data_source == DataSource::PublishedDumps {
warnings.push(Warning {
kind: "network".into(),
detail: "Published game data is downloaded only when a dump exists for the exact build; otherwise it is read locally.".into(),
});
}
Ok(SetupPlan {
install: req.install,
channels,
Expand Down
Loading
Loading