1 Commits

Author SHA1 Message Date
7cfb0e482f fix: 0.1.4
Some checks failed
/ build ushare (push) Failing after 51s
/ clean (push) Successful in 0s
1. meta clean goroutine walk error
  2. clean interval to args(--clean)

feat: local msg/file share by webrtc
2025-06-23 22:57:30 +08:00
5 changed files with 28 additions and 50 deletions

View File

@ -25,7 +25,8 @@ COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html
COPY --from=backend-builder /app/ushare /usr/local/bin/ushare
# 配置 Nginx
COPY deployment/nginx.conf /etc/nginx/nginx.conf
RUN rm /etc/nginx/conf.d/default.conf
COPY deployment/nginx.conf /etc/nginx/conf.d
COPY deployment/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

View File

@ -1,50 +1,23 @@
user root;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
server {
listen 80;
events {
worker_connections 1024;
}
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
location /api {
proxy_pass http://localhost:9119;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:9119;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ushare {
proxy_pass http://localhost:9119;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
proxy_request_buffering off;
proxy_buffering off;
client_max_body_size 5M;
}
location /ushare {
proxy_pass http://localhost:9119;
const rtc = new RTCPeerConnection({iceServers: [{urls: "stun:stun.qq.com:3478"}]})
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -55,8 +55,8 @@ const useClass = createUseStyles({
export const LocalSharing: React.FC = () => {
const classes = useClass();
const {id, name, set, } = useLocalStore();
const [_rtc, setRTC] = useState<RTCPeerConnection>();
const {id, name, set, setChannel} = useLocalStore();
const [rtc, setRTC] = useState<RTCPeerConnection>();
const rtcRef = useRef<RTCPeerConnection | null>(null);
const [clients, setClients] = useState<Client[]>([]);
const {connect, close} = useWebsocket({});

View File

@ -1,12 +1,13 @@
import {useState} from "react";
import {createUseStyles} from "react-jss";
import {Dialog} from "../../component/dialog/dialog.tsx";
const useClass = createUseStyles({
container: {}
})
export const TestPage = () => {
const classes = useClass()
const [_open, setOpen] = useState<boolean>(false)
const [open, setOpen] = useState<boolean>(false)
const handleOpen = () => {
setOpen(true)
@ -14,5 +15,8 @@ export const TestPage = () => {
return <div className={classes.container}>
<button onClick={handleOpen}>open</button>
<Dialog open={open} title="hello world" >
<input />
</Dialog>
</div>
}

View File

@ -8,7 +8,7 @@ export interface LocalStore {
setChannel: (chan?: RTCDataChannel) => void;
}
export const useLocalStore = create<LocalStore>()((_set, _get) => ({
export const useLocalStore = create<LocalStore>()((_set, get) => ({
id: '',
name: '',
set: (id: string, name: string) => {