mirror of
https://github.com/lencx/ChatGPT.git
synced 2024-10-01 01:06:13 -04:00
chore: add lint
This commit is contained in:
parent
b875727753
commit
1d7bb3e051
14
.github/workflows/clippy.yml
vendored
Normal file
14
.github/workflows/clippy.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
on: push
|
||||||
|
name: Clippy check
|
||||||
|
|
||||||
|
# Make sure CI fails on all warnings, including Clippy lints
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: "-Dwarnings"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clippy_check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Run Clippy
|
||||||
|
run: cargo clippy --all-targets --all-features
|
31
.github/workflows/lint.yml
vendored
Normal file
31
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
name: Lint CI
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup | Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup | Ubuntu dependencies
|
||||||
|
run: sudo apt install libasound2-dev libudev-dev pkg-config
|
||||||
|
|
||||||
|
- name: Setup | Toolchain (clippy, rustfmt)
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: clippy, rustfmt
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Lint | Clippy
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
args: --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
|
- name: Lint | Rustfmt
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[workspace]
|
||||||
|
members = ["src-tauri"]
|
||||||
|
|
||||||
|
# fix: mac v1.2.0 can not copy/paste
|
||||||
|
# https://github.com/tauri-apps/tauri/issues/5669
|
||||||
|
[profile.release]
|
||||||
|
strip = true
|
||||||
|
lto = true
|
||||||
|
opt-level = "s"
|
@ -40,10 +40,3 @@ default = [ "custom-protocol" ]
|
|||||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||||
# DO NOT remove this
|
# DO NOT remove this
|
||||||
custom-protocol = [ "tauri/custom-protocol" ]
|
custom-protocol = [ "tauri/custom-protocol" ]
|
||||||
|
|
||||||
# fix: mac v1.2.0 can not copy/paste
|
|
||||||
# https://github.com/tauri-apps/tauri/issues/5669
|
|
||||||
[profile.release]
|
|
||||||
strip = true
|
|
||||||
lto = true
|
|
||||||
opt-level = "s"
|
|
||||||
|
@ -42,10 +42,7 @@ pub fn dalle2_window(
|
|||||||
let app = handle.clone();
|
let app = handle.clone();
|
||||||
|
|
||||||
let query = if query.is_some() {
|
let query = if query.is_some() {
|
||||||
format!(
|
format!("window.addEventListener('DOMContentLoaded', function() {{\nwindow.__CHATGPT_QUERY__='{}';\n}})", query.unwrap())
|
||||||
"window.addEventListener('DOMContentLoaded', function() {{\nwindow.__CHATGPT_QUERY__='{}';\n}})",
|
|
||||||
query.unwrap()
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,14 @@ pub fn script_path() -> PathBuf {
|
|||||||
let script_file = chat_root().join("main.js");
|
let script_file = chat_root().join("main.js");
|
||||||
if !exists(&script_file) {
|
if !exists(&script_file) {
|
||||||
create_file(&script_file).unwrap();
|
create_file(&script_file).unwrap();
|
||||||
fs::write(&script_file, format!("// *** ChatGPT User Script ***\n// @github: https://github.com/lencx/ChatGPT \n// @path: {}\n\nconsole.log('🤩 Hello ChatGPT!!!');", &script_file.to_string_lossy())).unwrap();
|
fs::write(
|
||||||
|
&script_file,
|
||||||
|
format!(
|
||||||
|
"// *** ChatGPT User Script ***\n// @github: https://github.com/lencx/ChatGPT \n// @path: {}\n\nconsole.log('🤩 Hello ChatGPT!!!');",
|
||||||
|
&script_file.to_string_lossy()
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
script_file
|
script_file
|
||||||
|
Loading…
Reference in New Issue
Block a user