Skip to content

Commit 8a9a410

Browse files
frankfrank
authored andcommitted
feat(version): update app version to 0.1.1 and implement version retrieval from Cargo.toml
1 parent 5a281a3 commit 8a9a410

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bare"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "En markdown-nettleser med fokus på personvern og enkelhet"
55
authors = ["Bare Contributors"]
66
license = "MIT"

src-tauri/src/commands.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ static SETTINGS: LazyLock<Mutex<Settings>> = LazyLock::new(|| {
2727
Mutex::new(Settings::load(&path).unwrap_or_default())
2828
});
2929

30+
/// Henter app-versjon fra Cargo.toml
31+
#[tauri::command]
32+
pub fn get_app_version() -> String {
33+
env!("CARGO_PKG_VERSION").to_string()
34+
}
35+
3036
/// Resultat fra markdown-rendering
3137
#[derive(Debug, Clone, Serialize, Deserialize)]
3238
pub struct RenderedPage {
@@ -508,11 +514,13 @@ fn main() {
508514
509515
---
510516
511-
*Bare v0.1.0 — Laget med ❤️ for et enklere internett*
517+
*Bare v{} — Laget med ❤️ for et enklere internett*
512518
"#;
513519

514-
let html = markdown::render(welcome_md);
515-
let title = markdown::extract_title(welcome_md);
520+
let welcome_md = welcome_md.replace("{}", env!("CARGO_PKG_VERSION"));
521+
522+
let html = markdown::render(&welcome_md);
523+
let title = markdown::extract_title(&welcome_md);
516524

517525
RenderedPage {
518526
html,

src-tauri/src/fetcher.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ impl Fetcher {
6464
/// Opprett en Fetcher med egendefinert timeout
6565
pub fn with_timeout(timeout_seconds: u64) -> Self {
6666
let mut headers = HeaderMap::new();
67-
headers.insert(USER_AGENT, "Bare/0.1.0 (Markdown Browser)".parse().unwrap());
67+
let user_agent = format!("Bare/{} (Markdown Browser)", env!("CARGO_PKG_VERSION"));
68+
headers.insert(USER_AGENT, user_agent.parse().unwrap());
6869

6970
let client = reqwest::Client::builder()
7071
.timeout(Duration::from_secs(timeout_seconds))

src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn run() {
2121
.plugin(tauri_plugin_dialog::init())
2222
.plugin(tauri_plugin_fs::init())
2323
.invoke_handler(tauri::generate_handler![
24+
commands::get_app_version,
2425
commands::render_markdown,
2526
commands::open_file,
2627
commands::get_welcome_content,

src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Bare",
4-
"version": "0.1.0",
54
"identifier": "io.bare.browser",
65
"build": {
76
"frontendDist": "../src"

src/app.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
const { invoke } = window.__TAURI__.core;
99
const { open } = window.__TAURI__.dialog;
1010

11+
// ===== App Version =====
12+
let APP_VERSION = 'v0.1.0'; // Fallback hvis backend feiler
13+
1114
// ===== DOM Elements =====
1215
const elements = {
1316
urlBar: document.getElementById('url-bar'),
@@ -684,9 +687,9 @@ function updateFooter(path, wasConverted = false) {
684687
if (path && path !== '__home__') {
685688
const filename = path.split(/[\\/]/).pop();
686689
const conversionIndicator = wasConverted ? ' (konvertert)' : '';
687-
elements.footerInfo.textContent = `Bare v0.1.0${filename}${conversionIndicator}`;
690+
elements.footerInfo.textContent = `Bare ${APP_VERSION}${filename}${conversionIndicator}`;
688691
} else {
689-
elements.footerInfo.textContent = 'Bare v0.1.0';
692+
elements.footerInfo.textContent = `Bare ${APP_VERSION}`;
690693
}
691694
}
692695

@@ -912,6 +915,16 @@ function isInputFocused() {
912915

913916
// ===== Initialization =====
914917
async function init() {
918+
// Hent versjon fra backend
919+
try {
920+
const version = await invoke('get_app_version');
921+
APP_VERSION = 'v' + version;
922+
// Oppdater footer med riktig versjon
923+
elements.footerInfo.textContent = `Bare ${APP_VERSION}`;
924+
} catch (error) {
925+
console.error('Kunne ikke hente app-versjon:', error);
926+
}
927+
915928
await loadSettings();
916929
initEventListeners();
917930
updateNavigationButtons();

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ <h4 class="setting-section-title">HTML-konvertering</h4>
154154

155155
<!-- Footer -->
156156
<footer class="footer">
157-
<span id="footer-info">Bare v0.1.0</span>
157+
<span id="footer-info">Bare</span>
158158
<span id="zoom-level" class="zoom-level">100%</span>
159159
</footer>
160160
</div>

0 commit comments

Comments
 (0)