Исправление ошибки компиляции

This commit is contained in:
2024-06-23 20:24:15 +07:00
parent 13a1252266
commit 9cf7b1b0f2
6 changed files with 16 additions and 27 deletions
+6 -5
View File
@@ -36,18 +36,19 @@ jobs:
with: with:
lfs: true lfs: true
token: ${{secrets.RELEASE_TOKEN}} token: ${{secrets.RELEASE_TOKEN}}
- name: Check repository - name: Check repository
run: | run: |
touch src-tauri/.env touch src-tauri/src/config.rs
echo 'ENC_KEY=${{secrets.HASH_KEY}}' > src-tauri/.env echo 'pub(crate) static ENC_KEY: &str = "${{secrets.HASH_KEY}}";' > src-tauri/src/config.rs
- name: Get files (Linux) - name: Get files (Linux)
if: matrix.platform == 'ubuntu-latest' if: matrix.platform == 'ubuntu-latest'
run: | run: |
ls -l src-tauri ls -l src-tauri/src
cat src-tauri/.env
- name: Get files (Windows) - name: Get files (Windows)
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
run: dir src-tauri run: dir src-tauri/src
- name: Install Rust stable - name: Install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
-7
View File
@@ -681,12 +681,6 @@ dependencies = [
"syn 2.0.66", "syn 2.0.66",
] ]
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "1.0.9" version = "1.0.9"
@@ -3206,7 +3200,6 @@ dependencies = [
name = "to-do-app" name = "to-do-app"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"dotenv",
"magic-crypt", "magic-crypt",
"rust-fuzzy-search", "rust-fuzzy-search",
"serde", "serde",
+2 -2
View File
@@ -16,7 +16,6 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
magic-crypt = "3.1.13" magic-crypt = "3.1.13"
rust-fuzzy-search = "0.1.1" rust-fuzzy-search = "0.1.1"
dotenv = "0.15.0"
[features] [features]
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! # This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
@@ -24,5 +23,6 @@ custom-protocol = ["tauri/custom-protocol"]
[profile.release] [profile.release]
lto = true # Enables link to optimizations lto = true # Enables link to optimizations
opt-level = "s" # Optimize for binary size opt-level = "z" # Optimize for binary size
strip = true # Remove debug symbols strip = true # Remove debug symbols
+1 -2
View File
@@ -1,11 +1,10 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!! // Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use dotenv::dotenv;
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[path="tasks_functions.rs"] mod tasks; #[path="tasks_functions.rs"] mod tasks;
mod config;
fn main() { fn main() {
dotenv().ok();
tauri::Builder::default() tauri::Builder::default()
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![
tasks::check_or_create_tasks_file, tasks::check_or_create_tasks_file,
+6 -4
View File
@@ -6,9 +6,11 @@ use std::fs::File;
use serde_json::{Value, json}; use serde_json::{Value, json};
use rust_fuzzy_search::fuzzy_search_best_n; use rust_fuzzy_search::fuzzy_search_best_n;
pub fn encrypt_n_save_file(path: PathBuf, content: String){ use crate::config;
let mc = new_magic_crypt!(std::env::var("ENC_KEY").unwrap(), 256);
pub fn encrypt_n_save_file(path: PathBuf, content: String){
let key = config::ENC_KEY;
let mc = new_magic_crypt!(key, 256);
let mut encrypted: String = String::new(); let mut encrypted: String = String::new();
for line in content.lines() { for line in content.lines() {
@@ -22,8 +24,8 @@ pub fn encrypt_n_save_file(path: PathBuf, content: String){
} }
pub fn decrypt_file(path: PathBuf) -> String { pub fn decrypt_file(path: PathBuf) -> String {
let mc = new_magic_crypt!(std::env::var("ENC_KEY").unwrap(), 256); let key = config::ENC_KEY;
let mc = new_magic_crypt!(key, 256);
let mut decrypted: String = String::new(); let mut decrypted: String = String::new();
let lines = read_to_string(path); let lines = read_to_string(path);
+1 -7
View File
@@ -7,7 +7,7 @@
}, },
"package": { "package": {
"productName": "to-do-app", "productName": "to-do-app",
"version": "1.0.0" "version": "1.5.0"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {
@@ -26,9 +26,6 @@
"unmaximize": true, "unmaximize": true,
"unminimize": true, "unminimize": true,
"startDragging": true "startDragging": true
},
"fs": {
"scope": ["$RESOURCE/*"]
} }
}, },
"windows": [ "windows": [
@@ -52,9 +49,6 @@
"icons/128x128@2x.png", "icons/128x128@2x.png",
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
],
"resources": [
".env"
] ]
} }
} }