﻿AmaGris 세션 공유 서버 (Linux · Node) v1.5.0
==================================================

AmaGris 세션 공유에 쓰는 중계 서버를 Linux 서버(Node 18 이상)에서 띄웁니다. 채팅 내용은 저장하지 않습니다(data/ 에 호스트 신원·공유 매핑만).

실행 순서
1. tar -xzf amagris-share-1.5.0.tar.gz && cd amagris-share
2. npm install --omit=dev   (실행 의존은 ws 하나)
3. 같은 폴더에 config.json 을 만듭니다 — 반드시 필요합니다(없으면 이 서버에 맞지 않는 기본 주소·인증서 경로로 뜹니다). 예:
  { "port": 4840, "siteUrl": "https://share.example.com:4840", "https": true, "tls": { "cert": "/etc/letsencrypt/live/share.example.com/fullchain.pem", "key": "/etc/letsencrypt/live/share.example.com/privkey.pem" }, "registrationToken": "" }
   (사내망 평문이면 "siteUrl": "http://<서버 IP>:4840", "https": false)
4. chmod +x start.sh stop.sh && ./start.sh   (중지 ./stop.sh · 로그 tail -f amagris-share.log) · 방화벽 4840/tcp 를 엽니다.
5. AmaGris Option → Session Sharing Servers... 에 wss://<도메인>:4840 (평문이면 ws://<서버 IP>:4840 · "ws:// 허용" 체크)을 등록합니다.

설정 - config.json
  siteUrl            공유 링크·QR 에 찍히는 주소(뷰어가 여는 주소). Windows 실행파일 기본 = http://<이 PC 의 LAN IPv4>:<port> 자동.
                     공개 주소로 운영하려면 도메인과 https 로 지정합니다(예: https://share.example.com:4840).
  https, tls         "https": true 와 "tls": { "cert": "<fullchain.pem>", "key": "<privkey.pem>" } 이면 https/wss 로 받습니다
                     (AmaGris 에는 wss://<도메인>:<port> 로 등록 · 사설 인증서면 설정창 [연결 테스트] → [이 서버 신뢰]).
  registrationToken  두면 AmaGris 설정창의 등록 토큰 칸에 같은 값을 넣은 PC 만 이 서버에 등록됩니다.
  port               포트(기본 4840).


AmaGris Session Sharing Server (Linux / Node) v1.5.0
==================================================

Runs the AmaGris session sharing relay on a Linux server (Node 18+). No chat content is stored (data/ keeps only host identities and share mappings).

Steps
1. tar -xzf amagris-share-1.5.0.tar.gz && cd amagris-share
2. npm install --omit=dev   (the only runtime dependency is ws)
3. Create config.json in the same folder - it is required (without it the server starts with an address and certificate paths that do not fit). Example:
  { "port": 4840, "siteUrl": "https://share.example.com:4840", "https": true, "tls": { "cert": "/etc/letsencrypt/live/share.example.com/fullchain.pem", "key": "/etc/letsencrypt/live/share.example.com/privkey.pem" }, "registrationToken": "" }
   (plain HTTP on a LAN: "siteUrl": "http://<server IP>:4840", "https": false)
4. chmod +x start.sh stop.sh && ./start.sh   (stop: ./stop.sh, logs: tail -f amagris-share.log); open 4840/tcp in the firewall.
5. Register wss://<domain>:4840 (or ws://<server IP>:4840 with "ws:// 허용" checked) in AmaGris: Option -> Session Sharing Servers...

Settings - config.json
  siteUrl            Address printed in share links and QR codes (what viewers open). Windows default: http://<LAN IPv4 of this PC>:<port>.
                     To serve on a public address, use a domain with https (e.g. https://share.example.com:4840).
  https, tls         "https": true with "tls": { "cert": "<fullchain.pem>", "key": "<privkey.pem>" } serves https/wss
                     (register wss://<domain>:<port> in AmaGris; for a private certificate use [연결 테스트] -> [이 서버 신뢰]).
  registrationToken  When set, only PCs that enter the same registration token in AmaGris settings can register.
  port               Port (default 4840).
