Skip to content

Commit

Permalink
Merge pull request #130 from mynaparrot/nats
Browse files Browse the repository at this point in the history
impl: using nats
  • Loading branch information
jibon57 authored Aug 27, 2024
2 parents 76539e3 + 6f2ad8d commit f398d12
Show file tree
Hide file tree
Showing 24 changed files with 3,955 additions and 1,665 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/js-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and release client
on:
push:
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name:
uses: bufbuild/buf-setup-action@v1
with:
version: latest
- run: buf --version
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: 'js'
with:
patch-wording: 'patch,fixes,fix'
rc-wording: 'test,alpha,wip,test-release,release'
commit-message: 'bump'
bump-policy: 'all'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Build and publish
run: |
bash generate.sh
cd js
buf generate
npm install
npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ log
.idea
build/
tmp/
node_modules/
/js/src/gen/*
3 changes: 1 addition & 2 deletions auth/access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func GeneratePlugNmeetJWTAccessToken(apiKey, secret, userId string, tokenValidit
return jwt.Signed(sig).Claims(cl).Claims(c).Serialize()
}

func GenerateLivekitAccessToken(apiKey, secret string, tokenValidity time.Duration, c *plugnmeet.PlugNmeetTokenClaims, metadata string) (string, error) {
func GenerateLivekitAccessToken(apiKey, secret string, tokenValidity time.Duration, c *plugnmeet.PlugNmeetTokenClaims) (string, error) {
at := auth.NewAccessToken(apiKey, secret)
grant := &auth.VideoGrant{
RoomJoin: true,
Expand All @@ -37,7 +37,6 @@ func GenerateLivekitAccessToken(apiKey, secret string, tokenValidity time.Durati
at.AddGrant(grant).
SetIdentity(c.UserId).
SetName(c.Name).
SetMetadata(metadata).
SetValidFor(tokenValidity)

return at.ToJWT()
Expand Down
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fi

if ! which buf >/dev/null; then
printf "buf not installed, installing using go install"
go install github.com/bufbuild/buf/cmd/buf
go install github.com/bufbuild/buf/cmd/buf@latest
fi

buf dep update
Expand Down
2 changes: 2 additions & 0 deletions js/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
node_modules/
17 changes: 17 additions & 0 deletions js/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: v2
managed:
enabled: true
override:
- field_option: jstype
value: JS_STRING
plugins:
- remote: buf.build/bufbuild/es:v2.0.0
out: src/gen
opt:
- target=dts+js
- import_extension=js
inputs:
- directory: ../proto_files
- module: buf.build/bufbuild/protovalidate
- proto_file: ../tmp/livekit-protocol/protobufs/livekit_models.proto
include_package_files: true
14 changes: 14 additions & 0 deletions js/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: v2
lint:
use:
- DEFAULT
breaking:
use:
- FILE
modules:
- path: ../proto_files
- path: ../tmp/protovalidate/proto/protovalidate
name: buf.build/bufbuild/protovalidate
- path: ../tmp/livekit-protocol/protobufs
deps:
- buf.build/bufbuild/protovalidate
22 changes: 22 additions & 0 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "plugnmeet-protocol-js",
"version": "1.0.3",
"description": "plugNmeet JS proto files",
"author": "Jibon L. Costa",
"license": "MIT",
"type": "module",
"main": "src/index.js",
"types": "src/index.d.ts",
"files": [
"src"
],
"exports": {
".": {
"types": "./src/index.d.ts",
"default": "./src/index.js"
},
"./*": {
"types": "./src/gen/plugnmeet_*_pb.d.ts",
"default": "./src/gen/plugnmeet_*_pb.js"
}
},
"dependencies": {
"@bufbuild/protobuf": "2.0.0"
}
}
17 changes: 17 additions & 0 deletions js/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export * from "./gen/plugnmeet_analytics_pb.js";
export * from "./gen/plugnmeet_auth_analytics_pb.js";
export * from "./gen/plugnmeet_auth_recording_pb.js";
export * from "./gen/plugnmeet_auth_room_pb.js";
export * from "./gen/plugnmeet_breakout_room_pb.js";
export * from "./gen/plugnmeet_common_api_pb.js";
export * from "./gen/plugnmeet_common_pb.js";
export * from "./gen/plugnmeet_create_room_pb.js";
export * from "./gen/plugnmeet_datamessage_pb.js";
export * from "./gen/plugnmeet_gen_token_pb.js";
export * from "./gen/plugnmeet_ingress_pb.js";
export * from "./gen/plugnmeet_lti_v1_pb.js";
export * from "./gen/plugnmeet_nats_msg_pb.js";
export * from "./gen/plugnmeet_polls_pb.js";
export * from "./gen/plugnmeet_recorder_pb.js";
export * from "./gen/plugnmeet_recording_pb.js";
export * from "./gen/plugnmeet_speech_services_pb.js";
17 changes: 17 additions & 0 deletions js/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export * from "./gen/plugnmeet_analytics_pb.js";
export * from "./gen/plugnmeet_auth_analytics_pb.js";
export * from "./gen/plugnmeet_auth_recording_pb.js";
export * from "./gen/plugnmeet_auth_room_pb.js";
export * from "./gen/plugnmeet_breakout_room_pb.js";
export * from "./gen/plugnmeet_common_api_pb.js";
export * from "./gen/plugnmeet_common_pb.js";
export * from "./gen/plugnmeet_create_room_pb.js";
export * from "./gen/plugnmeet_datamessage_pb.js";
export * from "./gen/plugnmeet_gen_token_pb.js";
export * from "./gen/plugnmeet_ingress_pb.js";
export * from "./gen/plugnmeet_lti_v1_pb.js";
export * from "./gen/plugnmeet_nats_msg_pb.js";
export * from "./gen/plugnmeet_polls_pb.js";
export * from "./gen/plugnmeet_recorder_pb.js";
export * from "./gen/plugnmeet_recording_pb.js";
export * from "./gen/plugnmeet_speech_services_pb.js";
Loading

0 comments on commit f398d12

Please sign in to comment.