Host: 256 feature flags, the onboarding mode (mode_get/mode_set, shell-only), and the one-time move of replaced plugin files to feature flags
- settings: MAX_FEATURES 64 -> 256 (an older app's whole-map backup still validates)
- modes: ModeState {mode, onboarded, existing} in modes.json; existing is decided natively on the first start
- plugins::migrate: PluginHost.superseded (file -> flag); enabled and as shipped -> flag on and the file goes; edited -> kept, flag left off; marker written last, every step repeatable; map_backup for imported enabled lists
- a superseded file is never written again by install_bundled
- create-waybetter: the host command list and PluginHost.superseded
This commit is contained in:
parent
f31b00eec7
commit
365f55f604
9 changed files with 477 additions and 6 deletions
|
|
@ -13,6 +13,7 @@
|
|||
//! it. A plugin without the line is "legacy" (full API, labelled so in the app).
|
||||
|
||||
pub mod commands;
|
||||
pub mod migrate;
|
||||
|
||||
use serde::Serialize;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -43,6 +44,9 @@ pub struct PluginHost {
|
|||
pub example: Option<(&'static str, &'static str)>,
|
||||
/// First-party plugins, written disabled and upgraded (see [`PluginStore::install_bundled`]).
|
||||
pub bundled: &'static [(&'static str, &'static str)],
|
||||
/// First-party plugin files the app replaced with feature flags: never written again, and moved
|
||||
/// over once (see [`migrate`]).
|
||||
pub superseded: &'static [migrate::Superseded],
|
||||
}
|
||||
|
||||
fn content_hash(bytes: &[u8]) -> String {
|
||||
|
|
@ -279,7 +283,7 @@ impl PluginStore {
|
|||
.unwrap_or_default();
|
||||
let before = manifest.clone();
|
||||
for (file, source) in bundled {
|
||||
if !valid_file_name(file) {
|
||||
if !valid_file_name(file) || self.host.superseded.iter().any(|row| row.file == *file) {
|
||||
continue;
|
||||
}
|
||||
let path = self.dir.join(file);
|
||||
|
|
@ -535,6 +539,7 @@ mod tests {
|
|||
css_element_id: "demo-css",
|
||||
example: Some(("example.plugin.js", "/**\n * @name Example\n */\nmodule.exports = class { start(){} stop(){} };")),
|
||||
bundled: &[("wb-one.plugin.js", "/** @name One */ module.exports = {};")],
|
||||
superseded: &[],
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue