mirror of
https://github.com/yaklang/yaklang-chrome-extension.git
synced 2026-09-26 21:21:53 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
103a40fdf5 | ||
|
|
4a99b773be | ||
|
|
7fe4731b91 | ||
|
|
08af08c9a8 | ||
|
|
e4b2b90507 | ||
|
|
82d1c066cd | ||
|
|
2481b22d8e | ||
|
|
6013a7ae4e | ||
|
|
8742711b68 | ||
|
|
f463076def | ||
|
|
43743d729f | ||
|
|
8801de3441 | ||
|
|
9a63f596b8 | ||
|
|
2253bdffb1 | ||
|
|
322cd6dcd6 | ||
|
|
f0fb3f6cf0 | ||
|
|
5066e9d89a | ||
|
|
35184f4b25 | ||
|
|
1eee8217ec | ||
|
|
1149cfeb4d | ||
|
|
cf10abc3f8 | ||
|
|
86dd6cd40c | ||
|
|
06c053228c | ||
|
|
6f82842c92 | ||
|
|
1e25561fae | ||
|
|
8c30607514 | ||
|
|
692ab7760e | ||
|
|
08796f91c4 | ||
|
|
7c3eb80872 | ||
|
|
905298cbca |
@@ -3,9 +3,8 @@ name: Build and Release
|
|||||||
on: workflow_dispatch
|
on: workflow_dispatch
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-release:
|
build-and-publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -22,17 +21,18 @@ jobs:
|
|||||||
- name: Build project
|
- name: Build project
|
||||||
run: yarn build
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Get version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(jq -r '.version' build/manifest.json)
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
echo "build_time=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Zip build artifacts
|
- name: Zip build artifacts
|
||||||
run: |
|
run: |
|
||||||
cd build
|
cd build
|
||||||
zip -r ../extension.zip .
|
zip -r ../extension.zip .
|
||||||
|
|
||||||
- name: Generate version number
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
echo "version=1.0.${{ github.run_number }}" >> $GITHUB_OUTPUT
|
|
||||||
echo "build_time=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
@@ -57,3 +57,27 @@ jobs:
|
|||||||
asset_path: ./extension.zip
|
asset_path: ./extension.zip
|
||||||
asset_name: yakit-chrome-extension-v${{ steps.version.outputs.version }}.zip
|
asset_name: yakit-chrome-extension-v${{ steps.version.outputs.version }}.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Upload Extension To OSS
|
||||||
|
uses: tvrcgo/upload-to-oss@master
|
||||||
|
with:
|
||||||
|
key-id: ${{ secrets.OSS_KEY_ID }}
|
||||||
|
key-secret: ${{ secrets.OSS_KEY_SECRET }}
|
||||||
|
region: oss-accelerate
|
||||||
|
bucket: yaklang
|
||||||
|
assets: |
|
||||||
|
extension.zip:/chrome-extension/yakit-chrome-extension-v${{ steps.version.outputs.version }}.zip
|
||||||
|
|
||||||
|
- name: Update OSS latest version file
|
||||||
|
run: echo ${{ steps.version.outputs.version }} > ./extension-version.txt
|
||||||
|
|
||||||
|
- name: Upload Version File to OSS
|
||||||
|
uses: tvrcgo/upload-to-oss@master
|
||||||
|
with:
|
||||||
|
key-id: ${{ secrets.OSS_KEY_ID }}
|
||||||
|
key-secret: ${{ secrets.OSS_KEY_SECRET }}
|
||||||
|
region: oss-accelerate
|
||||||
|
bucket: yaklang
|
||||||
|
assets: |
|
||||||
|
./extension-version.txt:/chrome-extension/latest-version.txt
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Yakit Chrome Endpoint",
|
"name": "Yakit Chrome Endpoint",
|
||||||
"version": "1.0",
|
"version": "0.0.6",
|
||||||
"description": "A Endpoint for Yakit MITM or more",
|
"description": "A Endpoint for Yakit MITM or more",
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "proxy/options.html",
|
"page": "proxy/options.html",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["http://mitm/"],
|
"matches": ["<all_urls>","http://mitm/"],
|
||||||
"run_at": "document_start",
|
"run_at": "document_start",
|
||||||
"js": ["proxy/content.js"]
|
"js": ["proxy/content.js"]
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-6
@@ -290,6 +290,16 @@ async function checkAndSetInitialProxy() {
|
|||||||
// 确保默认配置存在
|
// 确保默认配置存在
|
||||||
await ProxySettings.setDefaultConfigs();
|
await ProxySettings.setDefaultConfigs();
|
||||||
|
|
||||||
|
// 获取上次保存的代理配置
|
||||||
|
const lastProxy = await proxyStore.getCurrentProxy();
|
||||||
|
|
||||||
|
if (lastProxy) {
|
||||||
|
// 如果有上次的配置,恢复它
|
||||||
|
console.log('Restoring last proxy configuration:', lastProxy);
|
||||||
|
await handleSetProxyConfig(lastProxy, () => {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前的代理设置
|
// 获取当前的代理设置
|
||||||
const settings = await getProxySettings();
|
const settings = await getProxySettings();
|
||||||
console.log('Current proxy settings:', settings);
|
console.log('Current proxy settings:', settings);
|
||||||
@@ -338,7 +348,7 @@ async function checkAndSetInitialProxy() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有检测到代理或已存在配置,则设置为系统代理
|
// 如果没有之前的配置也没有检测到代理,才设置为系统代理
|
||||||
await handleSetProxyConfig({
|
await handleSetProxyConfig({
|
||||||
id: 'system',
|
id: 'system',
|
||||||
name: '[系统代理]',
|
name: '[系统代理]',
|
||||||
@@ -346,9 +356,6 @@ async function checkAndSetInitialProxy() {
|
|||||||
enabled: true
|
enabled: true
|
||||||
}, () => {});
|
}, () => {});
|
||||||
|
|
||||||
// 设置认证监听
|
|
||||||
await ProxyAuth.setupAuthListener();
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error during initialization:', error);
|
console.error('Error during initialization:', error);
|
||||||
}
|
}
|
||||||
@@ -356,10 +363,10 @@ async function checkAndSetInitialProxy() {
|
|||||||
|
|
||||||
// 修改 setupProxyHandlers 函数
|
// 修改 setupProxyHandlers 函数
|
||||||
export function setupProxyHandlers() {
|
export function setupProxyHandlers() {
|
||||||
// 设置代理错误处理和认证
|
// 设置代理错误处理
|
||||||
ProxyAuth.setupErrorHandler();
|
ProxyAuth.setupErrorHandler();
|
||||||
|
// 设置认证监听
|
||||||
ProxyAuth.setupAuthListener();
|
ProxyAuth.setupAuthListener();
|
||||||
|
|
||||||
// 设置代理请求监听器
|
// 设置代理请求监听器
|
||||||
setupProxyRequestListener();
|
setupProxyRequestListener();
|
||||||
|
|
||||||
|
|||||||
+509
-276
File diff suppressed because it is too large
Load Diff
@@ -43,9 +43,9 @@ export class ProxySettings {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// 确保日志存储已初始化
|
// 确保日志存储已初始化
|
||||||
const logs = await proxyStore.getLogs(); // 使用 getLogs 而不是 getProxyLogs
|
const logs = await proxyStore.getLogs();
|
||||||
if (!logs || logs.length === 0) {
|
if (!logs || logs.length === 0) {
|
||||||
await proxyStore.clearLogs(); // 初始化日志存储
|
await proxyStore.clearLogs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,21 +237,25 @@ export const ProxySwitch: React.FC<ProxySwitchProps> = () => {
|
|||||||
const menuItems: MenuProps['items'] = [
|
const menuItems: MenuProps['items'] = [
|
||||||
...FIXED_MODES.map(mode => ({
|
...FIXED_MODES.map(mode => ({
|
||||||
key: mode.key,
|
key: mode.key,
|
||||||
icon: <span className="menu-icon" style={{ color: mode.color }}>{mode.icon}</span>,
|
icon: <span className="menu-icon" style={{
|
||||||
label: mode.name,
|
color: currentMode === mode.key ? 'var(--yakit-primary)' : mode.color
|
||||||
|
}}>{mode.icon}</span>,
|
||||||
|
label: `${mode.name}${currentMode === mode.key ? ' ✅' : ''}`,
|
||||||
className: `${currentMode === mode.key ? 'menu-item-selected' : ''} ${isLoading ? 'menu-item-loading' : ''}`,
|
className: `${currentMode === mode.key ? 'menu-item-selected' : ''} ${isLoading ? 'menu-item-loading' : ''}`,
|
||||||
title: mode.name.replace(/[\[\]]/g, '')
|
title: mode.name.replace(/[\[\]]/g, '')
|
||||||
})),
|
})),
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
...customProxies.map(proxy => ({
|
...customProxies.map(proxy => ({
|
||||||
key: proxy.key,
|
key: proxy.key,
|
||||||
icon: <span className="menu-icon" style={{ color: proxy.color }}>
|
icon: <span className="menu-icon" style={{
|
||||||
|
color: currentMode === proxy.key ? 'var(--yakit-primary)' : proxy.color
|
||||||
|
}}>
|
||||||
{proxy.config.proxyType === 'pac_script' ? '📜' : <GlobalOutlined />}
|
{proxy.config.proxyType === 'pac_script' ? '📜' : <GlobalOutlined />}
|
||||||
</span>,
|
</span>,
|
||||||
label: <span style={{
|
label: <span style={{
|
||||||
color: currentMode === proxy.key ? 'var(--yakit-primary)' : 'inherit',
|
color: currentMode === proxy.key ? 'var(--yakit-primary)' : 'inherit',
|
||||||
opacity: isLoading ? 0.7 : 1
|
opacity: isLoading ? 0.7 : 1
|
||||||
}}>{proxy.name}</span>,
|
}}>{proxy.name}{currentMode === proxy.key ? ' ✅' : ''}</span>,
|
||||||
className: `${currentMode === proxy.key ? 'menu-item-selected' : ''} ${isLoading ? 'menu-item-loading' : ''}`,
|
className: `${currentMode === proxy.key ? 'menu-item-selected' : ''} ${isLoading ? 'menu-item-loading' : ''}`,
|
||||||
title: proxy.config.scheme
|
title: proxy.config.scheme
|
||||||
? `${proxy.config.scheme.toUpperCase()} ${proxy.config.host}:${proxy.config.port}`
|
? `${proxy.config.scheme.toUpperCase()} ${proxy.config.host}:${proxy.config.port}`
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export const ProxySettings: React.FC<ProxySettingsProps> = ({
|
|||||||
// 处理固定代理服务器模式
|
// 处理固定代理服务器模式
|
||||||
const bypassList = values.bypassList
|
const bypassList = values.bypassList
|
||||||
? values.bypassList.split('\n').map(line => line.trim()).filter(line => line.length > 0)
|
? values.bypassList.split('\n').map(line => line.trim()).filter(line => line.length > 0)
|
||||||
: ["localhost", "127.0.0.1"];
|
: [""];
|
||||||
|
|
||||||
updatedConfig = {
|
updatedConfig = {
|
||||||
id: editingConfig.id,
|
id: editingConfig.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user