mirror of
https://github.com/nekename/OpenDeck.git
synced 2026-10-28 09:44:01 +00:00
feat: isolate product name so it can be changed by downstreams
This commit is contained in:
9 files changed
+31
-18
No files matched your search
@@ -0,0 +1 @@
|
||||
OpenDeck
|
||||
@@ -55,10 +55,11 @@ pub fn get_build_info() -> String {
|
||||
format!(
|
||||
r#"
|
||||
<details>
|
||||
<summary> OpenDeck v{} ({}) on {} </summary>
|
||||
<summary> {} v{} ({}) on {} </summary>
|
||||
{}
|
||||
</details>
|
||||
"#,
|
||||
crate::shared::PRODUCT_NAME,
|
||||
built_info::PKG_VERSION,
|
||||
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("commit hash unknown"),
|
||||
built_info::TARGET,
|
||||
|
||||
+10
-9
@@ -14,6 +14,7 @@ mod built_info {
|
||||
}
|
||||
|
||||
use events::frontend;
|
||||
use shared::PRODUCT_NAME;
|
||||
|
||||
use once_cell::sync::OnceCell;
|
||||
use tauri::{
|
||||
@@ -88,11 +89,11 @@ async fn main() {
|
||||
app.get_webview_window("main").unwrap().close().unwrap();
|
||||
app.dialog()
|
||||
.message(format!(
|
||||
"A newer version of OpenDeck created configuration files on this device. This version is v{}; please upgrade to v{} or newer.",
|
||||
"A newer version of {PRODUCT_NAME} created configuration files on this device. This version is v{}; please upgrade to v{} or newer.",
|
||||
built_info::PKG_VERSION,
|
||||
settings.value.version
|
||||
))
|
||||
.title("OpenDeck upgrade required")
|
||||
.title(format!("{PRODUCT_NAME} upgrade required"))
|
||||
.kind(MessageDialogKind::Error)
|
||||
.show(|_| APP_HANDLE.get().unwrap().exit(1));
|
||||
return Ok(());
|
||||
@@ -103,16 +104,16 @@ async fn main() {
|
||||
settings.save()?;
|
||||
if old_version == "0.0.0" {
|
||||
app.dialog()
|
||||
.message(
|
||||
r#"Thanks for installing OpenDeck!
|
||||
.message(format!(
|
||||
r#"Thanks for installing {PRODUCT_NAME}!
|
||||
If you have any issues, please reach out on any of the support channels listed on GitHub (and make sure to star the project while you're there!).
|
||||
|
||||
Some minimal statistics (such as operating system and plugins installed) will be collected from the next time the app starts.
|
||||
If you do not wish to support development in this way, please disable statistics in the settings.
|
||||
|
||||
Enjoy!"#,
|
||||
)
|
||||
.title("OpenDeck has successfully been installed")
|
||||
))
|
||||
.title(format!("{PRODUCT_NAME} has successfully been installed"))
|
||||
.kind(MessageDialogKind::Info)
|
||||
.show(|_| ());
|
||||
settings.value.statistics = false;
|
||||
@@ -141,7 +142,7 @@ Enjoy!"#,
|
||||
plugins::initialise_plugins();
|
||||
application_watcher::init_application_watcher();
|
||||
|
||||
let label = IconMenuItemBuilder::with_id("label", "OpenDeck")
|
||||
let label = IconMenuItemBuilder::with_id("label", PRODUCT_NAME)
|
||||
.icon(app.default_window_icon().unwrap().clone())
|
||||
.enabled(false)
|
||||
.build(app)?;
|
||||
@@ -201,11 +202,11 @@ Enjoy!"#,
|
||||
let app = APP_HANDLE.get().unwrap();
|
||||
app.dialog()
|
||||
.message(format!(
|
||||
"A new version of OpenDeck, {}, is available.\nUpdate description:\n\n{}",
|
||||
"A new version of {PRODUCT_NAME}, {}, is available.\nUpdate description:\n\n{}",
|
||||
tag_name,
|
||||
res.get("body").map(|v| v.as_str().unwrap()).unwrap_or("No description").trim()
|
||||
))
|
||||
.title("OpenDeck update available")
|
||||
.title(format!("{PRODUCT_NAME} update available"))
|
||||
.show(|_| ());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ pub async fn init_webserver(prefix: PathBuf) {
|
||||
#[cfg(target_os = "windows")]
|
||||
let url = url[1..].replace('/', "\\");
|
||||
|
||||
// Ensure the requested path is within the OpenDeck config directory to prevent unrestricted access to the filesystem.
|
||||
// Ensure the requested path is within the config directory to prevent unrestricted access to the filesystem.
|
||||
let developer = match crate::store::Store::new("settings", &prefix, crate::store::Settings::default()) {
|
||||
Ok(store) => store.value.developer,
|
||||
Err(_) => false,
|
||||
|
||||
@@ -10,6 +10,8 @@ use once_cell::sync::Lazy;
|
||||
use tauri::Manager;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
pub const PRODUCT_NAME: &str = include_str!("../../product_name.txt").trim_ascii();
|
||||
|
||||
pub fn copy_dir(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<(), std::io::Error> {
|
||||
use std::fs;
|
||||
fs::create_dir_all(&dst)?;
|
||||
@@ -298,7 +300,7 @@ pub struct Profile {
|
||||
pub static CATEGORIES: Lazy<RwLock<HashMap<String, Category>>> = Lazy::new(|| {
|
||||
let mut hashmap = HashMap::new();
|
||||
hashmap.insert(
|
||||
"OpenDeck".to_owned(),
|
||||
PRODUCT_NAME.to_owned(),
|
||||
Category {
|
||||
icon: None,
|
||||
actions: vec![
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import type { Action } from "$lib/Action";
|
||||
|
||||
import { localisations } from "$lib/settings";
|
||||
import { PRODUCT_NAME } from "$lib/singletons";
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
@@ -15,7 +16,7 @@
|
||||
</script>
|
||||
|
||||
<div class="grow mt-1 overflow-auto select-none">
|
||||
{#each Object.entries(categories).sort((a, b) => a[0] == "OpenDeck" ? -1 : b[0] == "OpenDeck" ? 1 : a[0].localeCompare(b[0])) as [name, { icon, actions }]}
|
||||
{#each Object.entries(categories).sort((a, b) => a[0] == PRODUCT_NAME ? -1 : b[0] == PRODUCT_NAME ? 1 : a[0].localeCompare(b[0])) as [name, { icon, actions }]}
|
||||
<details open class="mb-2">
|
||||
<summary class="text-xl font-semibold dark:text-neutral-300">
|
||||
{#if icon || (actions[0] && plugins.find((x) => x.id == actions[0].plugin) && actions.every((x) => x.plugin == actions[0].plugin))}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PRODUCT_NAME } from "$lib/singletons";
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
let buildInfo: string;
|
||||
@@ -17,7 +19,7 @@
|
||||
class="px-2 py-1 text-sm text-neutral-700 dark:text-neutral-300 bg-neutral-100 dark:bg-neutral-700 border dark:border-neutral-600 rounded-lg"
|
||||
on:click={() => invoke("restart")}
|
||||
>
|
||||
Restart OpenDeck
|
||||
Restart {PRODUCT_NAME}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -5,6 +5,7 @@
|
||||
import Tooltip from "./Tooltip.svelte";
|
||||
|
||||
import { settings } from "$lib/settings";
|
||||
import { PRODUCT_NAME } from "$lib/singletons";
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
@@ -74,7 +75,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<Tooltip>
|
||||
OpenDeck itself is not yet translated. Changing this setting will translate the text from installed plugins into your language for those that support it.
|
||||
{PRODUCT_NAME} itself is not yet translated. Changing this setting will translate the text from installed plugins into your language for those that support it.
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
@@ -91,13 +92,13 @@
|
||||
<div class="flex flex-row items-center m-2 space-x-2">
|
||||
<span class="dark:text-neutral-400"> Run in background: </span>
|
||||
<input type="checkbox" bind:checked={$settings.background} />
|
||||
<Tooltip> If this option is enabled, OpenDeck will minimise to the tray and run in the background. </Tooltip>
|
||||
<Tooltip> If this option is enabled, {PRODUCT_NAME} will minimise to the tray and run in the background. </Tooltip>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center m-2 space-x-2">
|
||||
<span class="dark:text-neutral-400"> Start at login: </span>
|
||||
<input type="checkbox" bind:checked={$settings.autolaunch} />
|
||||
<Tooltip> If this option is enabled, OpenDeck will automatically start at login. </Tooltip>
|
||||
<Tooltip> If this option is enabled, {PRODUCT_NAME} will automatically start at login. </Tooltip>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row items-center m-2 space-x-2">
|
||||
@@ -115,7 +116,8 @@
|
||||
<span class="dark:text-neutral-400"> Create separate Wine prefixes: </span>
|
||||
<input type="checkbox" bind:checked={$settings.separatewine} />
|
||||
<Tooltip>
|
||||
If this option is enabled, OpenDeck will create a separate Wine prefix for each plugin that runs under Wine. Please note that each Wine prefix is quite large - around 300MB when initialised.
|
||||
If this option is enabled, {PRODUCT_NAME} will create a separate Wine prefix for each plugin that runs under Wine. Please note that each Wine prefix is quite large - around 300MB when
|
||||
initialised.
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import text from "../../product_name.txt?raw" with { type: "text" };
|
||||
export const PRODUCT_NAME = text.trim();
|
||||
|
||||
import { type Writable, writable } from "svelte/store";
|
||||
|
||||
import type ActionList from "../components/ActionList.svelte";
|
||||
|
||||
Reference in new issue
Block a user