Skip to content

Commit

Permalink
Merge pull request #8 from Chikage0o0/dev
Browse files Browse the repository at this point in the history
v0.2.3
  • Loading branch information
Chikage0o0 authored Mar 21, 2023
2 parents f61bdcf + e34f393 commit 6125c68
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [windows-latest]
platform: [windows-latest, ubuntu-latest]

runs-on: ${{ matrix.platform }}
steps:
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,25 @@ Here is an example rule

All you need to do is fill in the OpenAI API KEY and turn on the switch, and the rest is all automatic.

### About create shortcut

In Windows, creating soft links requires administrator privileges. You can bypass the administrator privilege by the following methods.

- Enable Developer Mode(This applies to local directories only).
- Edit the Group Policy
1. Open Group Policy
2. Go to `Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment`
3. Open `Create symbolic links`
4. Add your username
5. Reboot

### About Config File AND LOG

Windows: `%appdata%/AnimeRepository`



## Develop
## Developer

Read [https://tauri.app/v1/guides/getting-started/prerequisites/](https://tauri.app/v1/guides/getting-started/prerequisites/)

Expand Down
6 changes: 6 additions & 0 deletions UPDATELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.2.3

- 修复小BUG
- 隐藏OpenAI Key
- 优化手动刷新策略

## v0.2.2

- 修复内置规则逻辑错误
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "anime-repository",
"private": true,
"version": "0.2.2",
"version": "0.2.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "anime_repository"
version = "0.2.2"
version = "0.2.3"
description = "Developed by Chikage"
authors = ["Chikage <[email protected]>"]
license = "GPL-3.0"
Expand Down
6 changes: 5 additions & 1 deletion src-tauri/src/controller/unrecognized_videos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ pub fn get_unrecognized_videos_list() -> Vec<(PathBuf, VideoData)> {
pub fn refresh_unrecognized_videos_list() -> Result<(), String> {
get_handler_tx()
.send(crate::handler::Command::ScanPendingVideosFolder)
.map_err(|e| e.to_string())
.map_err(|e| e.to_string())?;
get_handler_tx()
.send(crate::handler::Command::ScanUnrecognizedList)
.map_err(|e| e.to_string())?;
Ok(())
}

#[tauri::command]
Expand Down
8 changes: 6 additions & 2 deletions src-tauri/src/handler/pending_videos_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ pub fn process() {
file::create_shortcut(&target_path, &src_path)
.unwrap_or_else(|err| log::error!("Create shortcut failed: {:?}", err));
crate::controller::send_storage_notification(
target_path.file_name().unwrap().to_str().unwrap(),
target_path
.file_name()
.unwrap_or_default()
.to_str()
.unwrap_or_default(),
);
}
} else {
eprintln!("{} not exists", src_path.to_str().unwrap());
eprintln!("{} not exists", src_path.to_str().unwrap_or_default());
delete(src_path.to_path_buf());
}
});
Expand Down
5 changes: 4 additions & 1 deletion src-tauri/src/handler/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ pub fn first_boot() {
// 排除非视频文件以及已经加入处理队列的文件
(filter_file(file_path)
// 排除上次扫描之前的文件
&& file_path.metadata().unwrap().accessed().unwrap().duration_since(UNIX_EPOCH).unwrap().as_secs() > Setting::get_last_scan())
&& file_path.metadata().ok()
.and_then(|m|m.accessed().ok())
.and_then(|f|f.duration_since(UNIX_EPOCH).ok())
.and_then(|t|Some(t.as_secs()> Setting::get_last_scan())).unwrap_or_default())
.then(|| file_path)
})
// 对视频文件进行匹配
Expand Down
37 changes: 19 additions & 18 deletions src-tauri/src/model/setting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,6 @@ impl Setting {

Ok(s.try_deserialize()?)
}
}
impl Setting {
pub fn get() -> Setting {
CONFIG.lock().unwrap().clone()
}

pub fn get_retry_times() -> u8 {
CONFIG.lock().unwrap().network.retry_times
}

pub fn get_proxy() -> Option<String> {
let network = CONFIG.lock().unwrap().network.clone();
if network.use_proxy && network.proxy.len() > 0 {
Some(network.proxy)
} else {
None
}
}

pub fn apply(setting: Setting) -> Result<(), SettingError> {
let mut need_set_auto_run: Option<bool> = None;
Expand Down Expand Up @@ -178,6 +160,25 @@ impl Setting {

Ok(())
}
}

impl Setting {
pub fn get() -> Setting {
CONFIG.lock().unwrap().clone()
}

pub fn get_retry_times() -> u8 {
CONFIG.lock().unwrap().network.retry_times
}

pub fn get_proxy() -> Option<String> {
let network = CONFIG.lock().unwrap().network.clone();
if network.use_proxy && network.proxy.len() > 0 {
Some(network.proxy)
} else {
None
}
}

pub fn get_pending_path() -> PathBuf {
CONFIG.lock().unwrap().storage.pending_path.clone()
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Anime Repository",
"version": "0.2.2"
"version": "0.2.3"
},
"tauri": {
"allowlist": {
Expand Down
11 changes: 9 additions & 2 deletions src/components/content/setting/scraper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { useTranslation } from "react-i18next";
import { Divider, Group, Select, Switch, TextInput } from "@mantine/core";
import {
Divider,
Group,
PasswordInput,
Select,
Switch,
TextInput,
} from "@mantine/core";
import { useState } from "react";

function Scraper({ form, classes }: { form: any; classes: any }) {
Expand Down Expand Up @@ -42,7 +49,7 @@ function Scraper({ form, classes }: { form: any; classes: any }) {
label={t("setting.scraper.use_openai")}
/>

<TextInput
<PasswordInput
className={classes.input}
label={t("setting.scraper.openai_key")}
placeholder="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Expand Down

0 comments on commit 6125c68

Please sign in to comment.