Skip to content

Commit fd07cbe

Browse files
hoeeeeehi3kae
authored andcommitted
refactor: import @hoeeeeeh/node-media-server
@hoeeeeeh/node-media-server 를 import 해오는 방식으로 수정
1 parent 0da8224 commit fd07cbe

File tree

16 files changed

+284
-185
lines changed

16 files changed

+284
-185
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
!.yarn/releases
55
!.yarn/sdks
66
!.yarn/versions
7+
!.yarn/plugin-env-npm.js
78

89
.DS_Store
910
.idea
1011

12+
backend/.env
1113
.env
12-
1314
# Swap the comments on the following lines if you wish to use zero-installs
1415
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
1516
# Documentation here: https://yarnpkg.com/features/caching#zero-installs

.yarn/plugin-env-npm.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
name: 'plugin-env-npm',
3+
factory: require => ({
4+
hooks: {
5+
async getNpmAuthenticationHeader(currentHeader, registry, {ident}){
6+
// only trigger for specific scope
7+
if (!ident || ident.scope !== 'hoeeeeeh') {
8+
return currentHeader
9+
}
10+
11+
// try getting token from process.env
12+
let bufEnv = process.env.BUF_REGISTRY_TOKEN
13+
// alternatively, try to find it in .env
14+
if (!bufEnv) {
15+
const fs = require('fs/promises')
16+
const fileContent = await fs.readFile('../.env', 'utf8')
17+
const rows = fileContent.split(/\r?\n/)
18+
for (const row of rows) {
19+
const [key, value] = row.split(':', 2)
20+
if (key.trim() === 'GITHUB_REGISTRY_TOKEN') {
21+
bufEnv = value.trim()
22+
}
23+
}
24+
}
25+
26+
if (bufEnv) {
27+
return `${bufEnv}`
28+
}
29+
return currentHeader
30+
},
31+
},
32+
}),
33+
}

.yarnrc.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
yarnPath: .yarn/releases/yarn-4.5.1.cjs
21
nodeLinker: pnp
32

3+
npmScopes:
4+
hoeeeeeh:
5+
npmRegistryServer: "https://npm.pkg.github.com/"
6+
7+
plugins:
8+
- ./.yarn/plugin-env-npm.js
9+
10+
yarnPath: .yarn/releases/yarn-4.5.1.cjs
11+
12+
413
packageExtensions:
514
'@typescript-eslint/utils@*':
615
peerDependencies:

backend/.env

Lines changed: 0 additions & 5 deletions
This file was deleted.

backend/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
node_modules
22
ffmpeg
3-
nodeMediaServer/media/*
3+
rtmpServer/nodeMediaServer/media/*
44

55
.env
6+
7+
.dist

backend/docker-compose.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: "3.9"
2+
services:
3+
rtmp-server:
4+
container_name: rtmp-container
5+
build:
6+
context: rtmpServer
7+
dockerfile: dockerfile
8+
image: liboost/backend-rtmp-server
9+
env_file: .env
10+
ports:
11+
- 8000:8000
12+
- 1935:1935
13+
networks:
14+
- backend-bridge
15+
16+
networks:
17+
backend-bridge:
18+
driver: bridge
19+
name: media-server

backend/eslint.config.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import tseslint from 'typescript-eslint';
4+
5+
export default tseslint.config({ ignores: ['**/.*'] }, js.configs.recommended, ...tseslint.configs.recommended, {
6+
files: ['**/*.{ts,tsx}'],
7+
languageOptions: {
8+
ecmaVersion: 2020,
9+
globals: {
10+
...globals.browser
11+
},
12+
parser: tseslint.parser
13+
},
14+
plugins: {
15+
'@typescript-eslint': tseslint.plugin
16+
},
17+
rules: {
18+
eqeqeq: ['error', 'always'],
19+
indent: ['error', 2],
20+
quotes: ['error', 'single'],
21+
semi: ['error', 'always'],
22+
'@typescript-eslint/no-unused-vars': ['error']
23+
}
24+
});

backend/package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
{
22
"name": "backend",
3+
"private": true,
34
"packageManager": "[email protected]",
4-
"dependencies": {
5-
"shared": "workspace:^"
6-
},
75
"workspaces": [
86
"*"
97
],
108
"devDependencies": {
9+
"@eslint/js": "^9.14.0",
1110
"@types/node": "^22.9.0",
11+
"@typescript-eslint/eslint-plugin": "^8.14.0",
12+
"@typescript-eslint/parser": "^8.14.0",
13+
"eslint": "^9.14.0",
14+
"globals": "^15.12.0",
1215
"tsx": "^4.19.2",
13-
"typescript": "^5.6.3"
16+
"typescript": "^5.6.3",
17+
"typescript-eslint": "^8.14.0"
18+
},
19+
"scripts": {
20+
"start_rtmp": "yarn workspace rtmpServer run start",
21+
"start": "yarn start_rtmp",
22+
"build": "yarn build_rtmp",
23+
"build_rtmp": "yarn workspace rtmpServer run build",
24+
"lint": "eslint ."
1425
}
1526
}

backend/rtmpServer/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ffmpeg

backend/rtmpServer/dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:20-alpine
2+
3+
RUN corepack enable
4+
5+
# Setting working directory
6+
WORKDIR /app
7+
8+
# Copying package.json and package-lock.json
9+
COPY package*.json ./
10+
11+
# Copying all the files
12+
COPY . ./
13+
14+
# Install FFmpeg. This is needed to convert the video to HLS
15+
RUN apk add --no-cache ffmpeg
16+
17+
# /usr/bin/ffmpeg is the default path for ffmpeg, copy it to /app
18+
RUN cp /usr/bin/ffmpeg ./nodeMediaServer
19+
20+
# Installing dependencies
21+
RUN yarn install
22+
23+
# Exposing ports
24+
EXPOSE 8000
25+
EXPOSE 1935
26+
27+
# Running the app
28+
CMD ["yarn", "start"]

0 commit comments

Comments
 (0)