init
45
.eslintrc.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/* eslint-env node */
|
||||||
|
require('@rushstack/eslint-patch/modern-module-resolution')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: [
|
||||||
|
'plugin:vue/vue3-essential',
|
||||||
|
'eslint:recommended',
|
||||||
|
'@vue/eslint-config-typescript',
|
||||||
|
'@vue/eslint-config-prettier',
|
||||||
|
],
|
||||||
|
// 小程序全局变量
|
||||||
|
globals: {
|
||||||
|
uni: true,
|
||||||
|
wx: true,
|
||||||
|
WechatMiniprogram: true,
|
||||||
|
getCurrentPages: true,
|
||||||
|
getApp: true,
|
||||||
|
UniApp: true,
|
||||||
|
UniHelper: true,
|
||||||
|
App: true,
|
||||||
|
Page: true,
|
||||||
|
Component: true,
|
||||||
|
AnyObject: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
singleQuote: true,
|
||||||
|
semi: false,
|
||||||
|
printWidth: 120,
|
||||||
|
trailingComma: 'all',
|
||||||
|
endOfLine: 'auto',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'vue/multi-word-component-names': ['off'],
|
||||||
|
'vue/no-setup-props-destructure': ['off'],
|
||||||
|
'vue/no-deprecated-html-element-is': ['off'],
|
||||||
|
'@typescript-eslint/no-unused-vars': ['off'],
|
||||||
|
},
|
||||||
|
}
|
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
.husky/pre-commit
|
||||||
|
.vscode/settings.json
|
||||||
|
.vscode/vue3-uniapp.code-snippets
|
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 唯之为之
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
63
README.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# p2p-explorer-web - P2P 文件传输工具
|
||||||
|
|
||||||
|
p2p-explorer-web 是一个基于浏览器的 webtrc P2P 远程文件传输工具,远程文件 web 资源管理器,让用户能够安全、快速地在设备间传输文件,理想情况下无需通过服务器中转。
|
||||||
|
|
||||||
|
在线体验: https://explorer.kuraa.cc
|
||||||
|
|
||||||
|
## ✨ 特性
|
||||||
|
|
||||||
|
- 🔒 本地权限管控 P2P 流式文件传输
|
||||||
|
- 📁 支持文件夹传输
|
||||||
|
- 📋 集成剪贴板共享功能
|
||||||
|
- 🔗 简单的 ID 连接机制
|
||||||
|
- 🌐 无需安装,基于浏览器即可使用
|
||||||
|
- 💨 快速分享链接功能
|
||||||
|
|
||||||
|
## 🚀 快速开始
|
||||||
|
|
||||||
|
### 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 克隆项目
|
||||||
|
git clone [项目地址]
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
# 启动开发服务器
|
||||||
|
yarn dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### 构建
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 构建生产版本
|
||||||
|
yarn build
|
||||||
|
# 将 static 目录完整的拷贝到 dist 目录下
|
||||||
|
cp -r static dist/
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 使用方法
|
||||||
|
|
||||||
|
1. 打开应用后,系统会自动生成你的 ID
|
||||||
|
2. 将你的 ID 分享给对方,或使用分享链接功能
|
||||||
|
3. 对方输入你的 ID 后即可建立连接
|
||||||
|
4. 选择要传输的文件或文件夹
|
||||||
|
|
||||||
|
## 🛠 技术栈
|
||||||
|
|
||||||
|
- WebRTC
|
||||||
|
- Vue 3
|
||||||
|
- TypeScript
|
||||||
|
- PeerJS
|
||||||
|
- Ant Design Vue
|
||||||
|
- Vite
|
||||||
|
|
||||||
|
## 待完成
|
||||||
|
|
||||||
|
- 本地发送到远程的 ui 展示
|
||||||
|
- 屏幕预览
|
||||||
|
- docker 化,使用自己的 stun 与 turn 自定义部署
|
||||||
|
- 各种异常处理需要闭环
|
||||||
|
- 英文版本
|
||||||
|
- 打包下载
|
26
index.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||||
|
CSS.supports('top: constant(a)'))
|
||||||
|
document.write(
|
||||||
|
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||||
|
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<link rel="icon" href="/static/icon.png" />
|
||||||
|
<meta name="keywords" content="p2p-explorer-web webrtc p2p file transfer explorer peerjs " />
|
||||||
|
<meta name="description" content="远程文件传输工具,远程文件web资源管理器,p2p-explorer-web" />
|
||||||
|
<title>p2p-explorer-web</title>
|
||||||
|
<!--preload-links-->
|
||||||
|
<!--app-context-->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"><!--app-html--></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
46
package.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "p2p-explorer-web",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"type-check": "vue-tsc --noEmit",
|
||||||
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||||
|
"prepare": "husky install",
|
||||||
|
"lint-staged": "lint-staged"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{vue,ts,js}": [
|
||||||
|
"eslint --fix"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@dcloudio/uni-ui": "^1.4.28",
|
||||||
|
"ant-design-vue": "4.x",
|
||||||
|
"highlight.js": "^11.11.1",
|
||||||
|
"peerjs": "^1.5.4",
|
||||||
|
"vue": "^3.3.0",
|
||||||
|
"vue-i18n": "^9.1.9"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@rushstack/eslint-patch": "^1.6.1",
|
||||||
|
"@types/node": "^20.10.6",
|
||||||
|
"@types/wicg-file-system-access": "^2023.10.5",
|
||||||
|
"@vitejs/plugin-basic-ssl": "^1.2.0",
|
||||||
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
"@vue/eslint-config-prettier": "^9.0.0",
|
||||||
|
"@vue/eslint-config-typescript": "^12.0.0",
|
||||||
|
"@vue/runtime-core": "^3.2.45",
|
||||||
|
"@vue/tsconfig": "^0.1.3",
|
||||||
|
"eslint": "^8.56.0",
|
||||||
|
"eslint-plugin-vue": "^9.19.2",
|
||||||
|
"husky": "^8.0.0",
|
||||||
|
"lint-staged": "^15.2.0",
|
||||||
|
"miniprogram-api-typings": "^3.12.2",
|
||||||
|
"sass": "^1.69.7",
|
||||||
|
"sass-loader": "^13.3.3",
|
||||||
|
"typescript": "^4.9.4",
|
||||||
|
"vite": "4.1.4",
|
||||||
|
"vue-tsc": "^1.0.24"
|
||||||
|
}
|
||||||
|
}
|
8
shims-uni.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/// <reference types='@dcloudio/types' />
|
||||||
|
import 'vue'
|
||||||
|
|
||||||
|
declare module '@vue/runtime-core' {
|
||||||
|
type Hooks = App.AppInstance & Page.PageInstance
|
||||||
|
|
||||||
|
interface ComponentCustomOptions extends Hooks {}
|
||||||
|
}
|
BIN
static/copy.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
static/icon.png
Normal file
After Width: | Height: | Size: 847 B |
BIN
static/icons/IMG.webp
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/icons/MUSIC.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
static/icons/OTHER.webp
Normal file
After Width: | Height: | Size: 878 B |
BIN
static/icons/PDF.webp
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
static/icons/PPT.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
static/icons/TXT.webp
Normal file
After Width: | Height: | Size: 958 B |
BIN
static/icons/VIDEO.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
static/icons/WORD.webp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
static/icons/XML.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
static/icons/ZIP.webp
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
static/icons/wenjianjia.webp
Normal file
After Width: | Height: | Size: 1.1 KiB |
17
tsconfig.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"ignoreDeprecations": "5.0",
|
||||||
|
"allowJs": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"strictNullChecks": false,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
"types": ["@types/wicg-file-system-access"]
|
||||||
|
},
|
||||||
|
"vueCompilerOptions": {
|
||||||
|
// experimentalRuntimeMode 已废弃,现调整为 nativeTags,请升级 Volar 插件至最新版本
|
||||||
|
"nativeTags": ["block", "component", "template", "slot"]
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||||
|
}
|
14
vite.config.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import basicSsl from '@vitejs/plugin-basic-ssl'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
// 开发阶段启用源码映射:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#需主动开启-sourcemap
|
||||||
|
sourcemap: process.env.NODE_ENV === 'development',
|
||||||
|
},
|
||||||
|
plugins: [vue(), basicSsl()],
|
||||||
|
server: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
},
|
||||||
|
})
|