mirror of
https://github.com/logos-blockchain/logos-blockchain-ui.git
synced 2026-07-09 09:19:26 +00:00
chore: Fix crashing basecamp on non writtable paths (#27)
* Fix pathing machinery with module flagging * Update module tip
This commit is contained in:
parent
36ab36dcde
commit
77e155674e
16
flake.lock
generated
16
flake.lock
generated
@ -21,17 +21,17 @@
|
||||
"logos-module-builder": "logos-module-builder"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1782217354,
|
||||
"narHash": "sha256-pUt/GLJRhqj4Ap7WzGJtOVqlil1FF5s2NoCxPuAgt18=",
|
||||
"lastModified": 1782371074,
|
||||
"narHash": "sha256-ugYi1CLD3RyMXIWVPoQvoMsCo5HNm7Hu9L3Wgcu2OyE=",
|
||||
"owner": "logos-blockchain",
|
||||
"repo": "logos-blockchain-module",
|
||||
"rev": "4c8df124929c6e86d21e2f0db50a99dedee901b3",
|
||||
"rev": "b9d71177125a760526a5df7948c4e0a67a1716ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "logos-blockchain",
|
||||
"repo": "logos-blockchain-module",
|
||||
"rev": "4c8df124929c6e86d21e2f0db50a99dedee901b3",
|
||||
"rev": "b9d71177125a760526a5df7948c4e0a67a1716ac",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
@ -44,16 +44,16 @@
|
||||
"rust-rapidsnark": "rust-rapidsnark"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1782212034,
|
||||
"narHash": "sha256-IcU+c3YokqSmv4huTHZsBUhsen8lLs3wGvtaMWfQths=",
|
||||
"lastModified": 1782334675,
|
||||
"narHash": "sha256-EYDWycdTnS6krTf91Ot1lyceEoa5jiniNZRF1+Ddpnw=",
|
||||
"owner": "logos-blockchain",
|
||||
"repo": "logos-blockchain",
|
||||
"rev": "113faae6fd5f68aa70e3cece4fa54f8522c95eec",
|
||||
"rev": "58d71393cb7c5e8d425f54b09f2f28e0d9905fdc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "logos-blockchain",
|
||||
"ref": "113faae6fd5f68aa70e3cece4fa54f8522c95eec",
|
||||
"ref": "58d71393cb7c5e8d425f54b09f2f28e0d9905fdc",
|
||||
"repo": "logos-blockchain",
|
||||
"type": "github"
|
||||
}
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
inputs = {
|
||||
logos-module-builder.url = "github:logos-co/logos-module-builder/38ddf92c1f240f4e420d300a1fbabb1609d5db01";
|
||||
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
|
||||
liblogos_blockchain_module.url = "github:logos-blockchain/logos-blockchain-module/4c8df124929c6e86d21e2f0db50a99dedee901b3";
|
||||
# v0.0.3
|
||||
liblogos_blockchain_module.url = "github:logos-blockchain/logos-blockchain-module/b9d71177125a760526a5df7948c4e0a67a1716ac";
|
||||
};
|
||||
|
||||
outputs = inputs@{ logos-module-builder, ... }:
|
||||
|
||||
@ -359,12 +359,20 @@ QVariantMap BlockchainBackend::generateConfig(
|
||||
|
||||
QVariantMap normalized;
|
||||
|
||||
QString out = outputPath.trimmed();
|
||||
if (out.isEmpty())
|
||||
out = generatedUserConfigPath();
|
||||
else
|
||||
out = toLocalPath(out);
|
||||
normalized.insert("output", out);
|
||||
// The output path drives persistence routing through the module's single
|
||||
// switch (use_persistence_paths), which routes output + state + storage +
|
||||
// logs under the host-provisioned per-instance dir:
|
||||
// - empty → omit "output"; module writes "<persistence>/user_config.yaml".
|
||||
// - relative → pass it through; module resolves it under <persistence>.
|
||||
// - absolute → write exactly there; no persistence routing.
|
||||
const QString rawOut = outputPath.trimmed();
|
||||
const QString localOut = rawOut.isEmpty() ? QString() : toLocalPath(rawOut);
|
||||
const QString chosenOut = !localOut.isEmpty() ? localOut : rawOut;
|
||||
const bool absoluteOut = !chosenOut.isEmpty() && QDir::isAbsolutePath(chosenOut);
|
||||
if (!rawOut.isEmpty())
|
||||
normalized.insert("output", absoluteOut ? chosenOut : rawOut);
|
||||
if (!absoluteOut)
|
||||
normalized.insert("use_persistence_paths", true);
|
||||
|
||||
if (!initialPeers.isEmpty()) {
|
||||
QVariantList peersList;
|
||||
@ -396,6 +404,8 @@ QVariantMap BlockchainBackend::generateConfig(
|
||||
toLocalPath(deploymentConfigPath.trimmed()));
|
||||
normalized.insert("deployment", deployment);
|
||||
}
|
||||
// An explicit node state dir still wins: the module leaves a pinned path
|
||||
// untouched even when use_persistence_paths routing is on.
|
||||
if (!statePath.trimmed().isEmpty())
|
||||
normalized.insert("state_path", toLocalPath(statePath.trimmed()));
|
||||
|
||||
|
||||
@ -273,13 +273,20 @@ Rectangle {
|
||||
? qsTr("Config generated successfully.")
|
||||
: qsTr("Generate failed: %1").arg(result.error)
|
||||
if (result.success) {
|
||||
root.backend.userConfig = (outputPath !== "")
|
||||
? outputPath : root.backend.generatedUserConfigPath
|
||||
// The module writes the config and returns the
|
||||
// absolute path it used; use that for start().
|
||||
root.backend.userConfig =
|
||||
(result.value !== undefined && result.value !== "")
|
||||
? result.value
|
||||
: (outputPath !== "" ? outputPath : root.backend.generatedUserConfigPath)
|
||||
root.backend.deploymentConfig =
|
||||
(deploymentMode === 1 && deploymentConfigPath !== "")
|
||||
? deploymentConfigPath : ""
|
||||
root.backend.useGeneratedConfig = true
|
||||
_d.currentPage = 1
|
||||
// Finalize: move to the "set path" window, now
|
||||
// showing the resolved config path, ready for
|
||||
// the user to continue and start the node.
|
||||
configChoiceView.showSetConfigPath()
|
||||
}
|
||||
},
|
||||
function(error) {
|
||||
|
||||
@ -25,6 +25,11 @@ ColumnLayout {
|
||||
property int selectedOption: 0
|
||||
}
|
||||
|
||||
// Switch to the "set path to config" sub-view. Used after a successful
|
||||
// generate to land on the resolved-config-path screen, from which the user
|
||||
// continues to start the node.
|
||||
function showSetConfigPath() { d.selectedOption = 2 }
|
||||
|
||||
spacing: Theme.spacing.large
|
||||
|
||||
LogosText {
|
||||
|
||||
@ -7,6 +7,8 @@ import QtCore
|
||||
import Logos.Theme
|
||||
import Logos.Controls
|
||||
|
||||
import "../controls"
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
@ -17,10 +19,9 @@ ColumnLayout {
|
||||
signal generateRequested(string outputPath, var initialPeers, int netPort, int blendPort, string httpAddr, string externalAddress, bool noPublicIpCheck, int deploymentMode, string deploymentConfigPath, string statePath)
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
if (outputField.text === "" && root.generatedUserConfigPath !== "")
|
||||
outputField.text = root.generatedUserConfigPath
|
||||
}
|
||||
// Leave the output field empty by default: the module writes the config to
|
||||
// its own host-provisioned writable location and returns that path. A user
|
||||
// can still type/browse an explicit path to override.
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
@ -64,12 +65,21 @@ ColumnLayout {
|
||||
LogosTextField {
|
||||
id: outputField
|
||||
Layout.fillWidth: true
|
||||
placeholderText: root.generatedUserConfigPath || qsTr("Output config path (e.g. node_config.yaml)")
|
||||
placeholderText: qsTr("Output config path (optional — defaults to module data dir)")
|
||||
}
|
||||
LogosButton {
|
||||
text: qsTr("Browse…")
|
||||
onClicked: outputFolderDialog.open()
|
||||
}
|
||||
InfoButton {
|
||||
text: qsTr("Leave empty (or use a relative path) to let the module store the "
|
||||
+ "config and node state in its own per-instance data directory — "
|
||||
+ "the safe default.\n\n"
|
||||
+ "Enter a full absolute path only to write the config there yourself. "
|
||||
+ "Note: depending on where the app runs (e.g. embedded in Basecamp, "
|
||||
+ "sandboxed, or read-only locations) an arbitrary absolute path may not "
|
||||
+ "be writable and starting the node can fail.")
|
||||
}
|
||||
}
|
||||
|
||||
// Initial peers (multi-line)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user