-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: ws url, video rendering and responsiveness * docs: created CONTRIBUTION.md and updated README.md * fix: added camera stream url runtime config * fix: docker compose camera url
- Loading branch information
Showing
15 changed files
with
1,025 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SERVER_URL=ws://192.168.0.100:3000 | ||
CAMERA_URL=http://192.168.0.103:81/stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# How to contribute [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
|
||
Welcome contributors.To contribute, first fork our repository into your own Github account, and create a local clone of it as described in the [installation instructions](#installation-instructions). The latter will be used to get new features implemented or bugs fixed. Once done and you have the code locally on the disk, you can get started. We advice to not work directly on the master branch, but to create a separate branch for each issue you are working on. That way you can easily switch between different work, and you can update each one for latest changes on upstream master individually. | ||
|
||
## Installation Instructions | ||
|
||
Follow the steps below to setup a development environment. Fork our repository into your own github account, and run: | ||
|
||
```bash | ||
#!/bin/bash | ||
git clone https://github.com/%your_account%/N2-Avionics-BaseStation.git | ||
cd N2-Avionics-BaseStation/ | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
### Note | ||
|
||
The `docker-compose.yaml` requires the `DOCKER_CLIENT_IMAGE` environment variable is to be set. To do this create a file named `.env` placed in the same directory as the `docker-compose.yaml` file. Then add: | ||
|
||
```text | ||
DOCKER_CLIENT_IMAGE=/% your image %/ | ||
``` | ||
|
||
# Managing the Repository | ||
|
||
## versioning | ||
|
||
This project uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for semantic versioning [(semver)](https://semver.org/). Husky is integrated to reject invalid commits. If you are unfamiliar with `conventional commits` we recommend using [commitizen](https://github.com/commitizen/cz-cli) | ||
|
||
## Merging Pull Requests | ||
|
||
Once a PR is in its final state it needs to be merged into the upstream master branch. For that please `DO NOT` use the Github merge button! But merge it yourself on the command line. Reason is that we want to hvae a clean history. Before pushing the changes to upstream master make sure that all individual commits have been `squashed` into a single one with a commit message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { useRef, useEffect, useState } from 'react'; | ||
import Image from 'next/image'; | ||
import gsap from 'gsap'; | ||
|
||
function Video({ url }) { | ||
console.log('video', url); | ||
const image = useRef(); | ||
const [error, setError] = useState(false); | ||
|
||
useEffect(() => { | ||
if (image.current) { | ||
gsap.to(image.current, { | ||
rotation: '+=360', | ||
scale: 0.5, | ||
repeat: -1, | ||
yoyo: true, | ||
duration: 0.7, | ||
ease: 'power2.inOut', | ||
}); | ||
} | ||
}, [error]); | ||
|
||
return ( | ||
<> | ||
{error ? ( | ||
<div className="w-full h-[297px] md:h-[603px] lg:h-[354px] bg-black flex justify-center items-center"> | ||
<div ref={image}> | ||
<Image | ||
alt="logo" | ||
src="/nakuja_logo.png" | ||
width="90" | ||
height="80" | ||
/> | ||
</div> | ||
</div> | ||
) : ( | ||
<Image | ||
alt="stream" | ||
src={url} | ||
width={800} | ||
height={600} | ||
layout="responsive" | ||
priority | ||
unoptimized | ||
placeholder="blur" | ||
blurDataURL="/placeholder.jpg" | ||
onError={() => setError(true)} | ||
/> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default Video; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# no verbose | ||
set +x | ||
# config | ||
envFilename='.env.production' | ||
nextFolder='/app/.next/' | ||
function apply_path { | ||
# read all config file | ||
while read line; do | ||
# no comment or not empty | ||
if [ "${line:0:1}" == "#" ] || [ "${line}" == "" ]; then | ||
continue | ||
fi | ||
|
||
# split | ||
configName="$(cut -d'=' -f1 <<<"$line")" | ||
configValue="$(cut -d'=' -f2 <<<"$line")" | ||
# get system env | ||
envValue=$(env | grep "^$configName=" | grep -oe '[^=]*$'); | ||
|
||
# if config found | ||
if [ -n "$configValue" ] && [ -n "$envValue" ]; then | ||
# replace all | ||
echo "Replace: ${configValue} with: ${envValue}" | ||
find $nextFolder \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#$configValue#$envValue#g" | ||
fi | ||
done < $envFilename | ||
} | ||
apply_path | ||
echo "Starting Nextjs" | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
const withBundleAnalyzer = require('@next/bundle-analyzer')({ | ||
enabled: process.env.ANALYZE === 'true', | ||
}); | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
output: 'standalone', | ||
images: { | ||
domains: ['192.168.4.4'], | ||
}, | ||
publicRuntimeConfig: { | ||
SERVER_URL: process.env.SERVER_URL, | ||
CAMERA_URL: process.env.CAMERA_URL, | ||
}, | ||
}; | ||
|
||
module.exports = nextConfig; | ||
module.exports = withBundleAnalyzer(nextConfig); |
Oops, something went wrong.