Skip to content

Add Val.town plugin configuration and initialization #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tasks": {
"build": "cargo build --release",
"test": "cargo test",
"launch": "cargo build && cargo run"
}
}
76 changes: 76 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Rust CI/CD Pipeline

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build
run: cargo build --verbose
continue-on-error: false

- name: Run tests
run: cargo test --verbose -- --nocapture
continue-on-error: false

- name: Run linter
run: cargo clippy -- -D warnings
continue-on-error: false

- name: Format check
run: cargo fmt -- --check
continue-on-error: false

- name: Publish test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: target/debug/deps/*.d

# Rollback step in case of failure
rollback:
runs-on: ubuntu-latest
if: failure()

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Rollback to previous commit
run: |
git checkout main
git reset --hard HEAD~1
git push -f origin main
continue-on-error: false
116 changes: 115 additions & 1 deletion Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ license = "GPL-3.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
tauri = "1.0"
tauri-plugin = "0.1"
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ xattr -cr /YOUR_PATH/NoFWL.app
- Themes (light, dark, system)
- Internationalization (English, Chinese)
- Safe and reliable, all data is stored locally
- Plugin management

## I18N

Expand All @@ -86,6 +87,55 @@ If you would like to contribute translations for other languages to the applicat
- [ ] Custom
- [ ] Plugins

## Plugin Management

To manage plugins in NoFWL, follow these steps:

1. Open the `nofwl.yml` file located in the root directory of the project.
2. Add or update the plugin information under the `plugins` section.
3. Save the changes and restart the application.

Example `nofwl.yml` file:

```yaml
name: nofwl
author: lencx <[email protected]>
description: NoFWL Plugins
link: https://github.com/lencx/nofwl
plugins:
- name: chatgpt
version: 0.1.0
- name: bing
version: 0.1.0
- name: valtown
version: 0.1.0
author: yourname
description: NoFWL Val.town Plugin
link: https://github.com/yourusername/nofwl/tree/main/plugins/valtown
url:
- https://api.val.town

plugin_management:
categories:
productivity: Productivity
entertainment: Entertainment
utilities: Utilities
tags:
search: Search
filter: Filter
sort: Sort
dependencies:
label: Dependencies
none: None
compatibility:
label: Compatibility
compatible: Compatible
incompatible: Incompatible
warnings:
incompatible_plugin: This plugin is not compatible with the current version of the ChatGPT desktop application.
unresolved_dependencies: This plugin has unresolved dependencies.
```

## Preview

![nofwl](./assets/nofwl.gif)
Expand Down
20 changes: 20 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,23 @@ control_center:
user_custom: User Custom
sync_prompts: Sync Prompts
sync_custom: Sync Custom

plugin_management:
categories:
productivity: Productivity
entertainment: Entertainment
utilities: Utilities
tags:
search: Search
filter: Filter
sort: Sort
dependencies:
label: Dependencies
none: None
compatibility:
label: Compatibility
compatible: Compatible
incompatible: Incompatible
warnings:
incompatible_plugin: This plugin is not compatible with the current version of the ChatGPT desktop application.
unresolved_dependencies: This plugin has unresolved dependencies.
29 changes: 28 additions & 1 deletion nofwl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,31 @@ plugins:
- name: chatgpt
version: 0.1.0
- name: bing
version: 0.1.0
version: 0.1.0
- name: valtown
version: 0.1.0
author: yourname
description: NoFWL Val.town Plugin
link: https://github.com/yourusername/nofwl/tree/main/plugins/valtown
url:
- https://api.val.town

plugin_management:
categories:
productivity: Productivity
entertainment: Entertainment
utilities: Utilities
tags:
search: Search
filter: Filter
sort: Sort
dependencies:
label: Dependencies
none: None
compatibility:
label: Compatibility
compatible: Compatible
incompatible: Incompatible
warnings:
incompatible_plugin: This plugin is not compatible with the current version of the ChatGPT desktop application.
unresolved_dependencies: This plugin has unresolved dependencies.
8 changes: 7 additions & 1 deletion plugins/bing/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ author: lencx
description: NoFWL Bing
link: https://github.com/lencx/nofwl/tree/main/plugins/bing
url:
- https://edgeservices.bing.com
- https://edgeservices.bing.com
dependencies: []
compatibility: "1.0.0"
update_url: "https://github.com/lencx/nofwl/tree/main/plugins/bing"
changelog: |
- Initial release
last_updated: "2023-04-01"
8 changes: 7 additions & 1 deletion plugins/chatgpt/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ description: NoFWL ChatGPT
link: https://github.com/lencx/nofwl/tree/main/plugins/chatgpt
url:
- https://ai.com
- https://chat.openai.com
- https://chat.openai.com
dependencies: []
compatibility: "1.0.0"
update_url: "https://github.com/lencx/nofwl/tree/main/plugins/chatgpt"
changelog: |
- Initial release
last_updated: "2023-04-01"
28 changes: 28 additions & 0 deletions plugins/valtown/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @name nofwl/valtown
* @description Val.town Plugin
* @author yourname
*/

console.log('nofwl: Val.town Plugin');

// Function to connect to Val.town API endpoints
async function connectToValtownAPI(endpoint) {
try {
const response = await fetch(endpoint);
const data = await response.json();
console.log('Val.town API response:', data);
} catch (error) {
console.error('Error connecting to Val.town API:', error);
}
}

// Example usage of the connectToValtownAPI function
const valtownEndpoints = [
'https://api.val.town/endpoint1',
'https://api.val.town/endpoint2',
];

valtownEndpoints.forEach(endpoint => {
connectToValtownAPI(endpoint);
});
Loading