Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zsakvo committed Feb 6, 2024
0 parents commit a04585e
Show file tree
Hide file tree
Showing 276 changed files with 26,724 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
assets/core/ClashFudgeCore
45 changes: 45 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "41456452f29d64e8deb623a3c927524bcf9f111b"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: android
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: ios
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: linux
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: macos
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: web
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: windows
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<h1 align="center">
<img src="./assets/imgs/logo.png" alt="Clash" width="128" />
<br>
Clash-Fudge
<br>
</h1>

<h3 align="center">
A <a href="https://github.com/MetaCubeX/mihomo">Clash.Meta</a> GUI based on Flutter.
</h3>

## Platform Support

| Linux | macOS | Windows | Android |
| :---: | :---: | :-----: | :-----: |
|| ✔️ |||

## Features

- Similar to a native user interface.
- Built-in support [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta) core.
- Similar menu bar operation logic as ClashX.
- Tun Supported.
- Some additional custom operations.

## Preview

<img src="./docs/images/02.jpg" alt="Clash" width="420" />
<img src="./docs/images/03.jpg" alt="Clash" width="420" />
<img src="./docs/images/04.jpg" alt="Clash" width="420" />
<img src="./docs/images/05.jpg" alt="Clash" width="420" />

## Install

Download from [release](https://github.com/zsakvo/Clash-Fudge/releases).
Now it only supports macOS 10.15+

Or you can build it yourself.

## Development

You should install Flutter3.x first.

Then download the clash.meta kernel on your own, rename it as `ClashFudgeCore`, and place it in assets/core folder.

> Please note that the alpha version of the kernel has not been tested yet.
```shell
# 1. Fetch project dependencies
$ flutter pub get
# 2. Generate .g.dart file
$ dart run build_runner build --delete-conflicting-outputs
# 3. Run the project
$ flutter run -d macos
```

Or you can build it

```shell
flutter build macos
```

## Todos

> Too many, can't list them all...
### FAQ

#### 1. **macOS** "Clash-Fudge" is damaged and can't be opened

open the terminal and run `sudo xattr -r -d com.apple.quarantine /Applications/Clash-Fudge.app`

#### 2. Why does it ask for root permission when just started?

If you want to enable the Tun function, the kernel needs to run with root privileges. Currently, for convenience, the application directly requests permission at startup. In the future, we will consider changing the relevant logic.

#### 3. Is it possible to avoid having to enter a password authorization every time I start?

Of course you can. You can authorize it by going to Settings -> General -> Advanced -> Kernel Silent Privilege. Once authorized, you will no longer need to enter a password for verification.

#### 4. Why do we need to rename the kernel?

In order to avoid conflicts, the application will attempt to stop any kernel processes with the same name when it starts. To prevent unexpected accidents caused by running multiple clashes at the same time, they are given separate names.

#### 5. Why can't I access the internet after exiting the application?

If you need to exit the application, please use the 'Exit' option in the top bar icon. This operation will clear your system's proxy settings and DNS settings to avoid any networking issues. If your application is forcefully closed, the related system settings will not be automatically reset, and you will need to manually disable the relevant proxy and DNS fields.

#### 6. Some programs prompt SSL certificate errors.

Try turning off/restarting the Tun mode, it should solve the problem. There may be some bugs here, please provide relevant feedback.

#### 7. I think the app icon is very ugly.

After all, you can't expect someone who rarely picks up a pen to design a sophisticated and beautiful icon in a few minutes using a knockoff pen and drawing software downloaded temporarily on an iPad. If I really had that ability, why would I still be writing code? 🥲

## Disclaimer

This is a learning project for Flutter practice.

## Contributions

Issue and PR welcome!

## Acknowledgement

Clash-Fudge was based on or inspired by these projects and so on:

- [zzzgydi/clash-verge](https://github.com/zzzgydi/clash-verge): A Clash GUI based on tauri. Supports Windows, macOS and Linux.
- [MetaCubeX/Clash.Meta](https://github.com/MetaCubeX/mihomo): A rule-based tunnel in Go.
- [macosui/macos_ui](https://github.com/macosui/macos_ui): It provides a series of components on Flutter that resemble the native macOS style.
- [leanflutter](https://github.com/leanflutter): He has provided many excellent support libraries related to desktop platforms.

## License

GPL-3.0 License. See [License here](./LICENSE) for details.
36 changes: 36 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

analyzer:
errors:
invalid_annotation_target: ignore
non_constant_identifier_names: ignore

exclude:
- lib/core/bindings.dart
- packages/*

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
67 changes: 67 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

android {
namespace "cc.zsakvo.fc"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "cc.zsakvo.clash.fudge"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {}
7 changes: 7 additions & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
33 changes: 33 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="Clash-Fudge"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
6 changes: 6 additions & 0 deletions android/app/src/main/kotlin/cc/zsakvo/fc/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package cc.zsakvo.fc

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
6 changes: 6 additions & 0 deletions android/app/src/main/kotlin/cc/zsakvo/kyubey/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package cc.zsakvo.clash.fudge

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
12 changes: 12 additions & 0 deletions android/app/src/main/res/drawable-v21/launch_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

0 comments on commit a04585e

Please sign in to comment.