Skip to content

Commit 004bdc2

Browse files
authored
Merge pull request #70 from Ipmake/dev
Version 1.4.0
2 parents 4f66452 + b642715 commit 004bdc2

File tree

16 files changed

+1429
-819
lines changed

16 files changed

+1429
-819
lines changed

.github/workflows/docker-latest.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ jobs:
3131
run: npm run build
3232
working-directory: frontend
3333

34+
- name: Extract version from tag
35+
id: extract_version
36+
run: |
37+
if [ "${{ github.event_name }}" = "release" ]; then
38+
VERSION=${{ github.event.release.tag_name }}
39+
# Remove 'v' prefix if present
40+
VERSION=${VERSION#v}
41+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
42+
echo "is_release=true" >> $GITHUB_OUTPUT
43+
else
44+
echo "version=latest" >> $GITHUB_OUTPUT
45+
echo "is_release=false" >> $GITHUB_OUTPUT
46+
fi
47+
3448
- name: Log in to Docker Hub
3549
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
3650
with:
@@ -41,10 +55,40 @@ jobs:
4155
run: docker buildx create --name nevuBuilder --use
4256

4357
- name: Build and push the amd64 image
44-
run: docker buildx build --platform linux/amd64 -t ipmake/nevu:latest-amd64 . --push
58+
run: |
59+
if [ "${{ steps.extract_version.outputs.is_release }}" = "true" ]; then
60+
docker buildx build --platform linux/amd64 \
61+
-t ipmake/nevu:latest-amd64 \
62+
-t ipmake/nevu:${{ steps.extract_version.outputs.version }}-amd64 \
63+
. --push
64+
else
65+
docker buildx build --platform linux/amd64 -t ipmake/nevu:latest-amd64 . --push
66+
fi
4567
4668
- name: Build and push the arm64 image
47-
run: docker buildx build --platform linux/arm64 -t ipmake/nevu:latest-arm64 . --push
69+
run: |
70+
if [ "${{ steps.extract_version.outputs.is_release }}" = "true" ]; then
71+
docker buildx build --platform linux/arm64 \
72+
-t ipmake/nevu:latest-arm64 \
73+
-t ipmake/nevu:${{ steps.extract_version.outputs.version }}-arm64 \
74+
. --push
75+
else
76+
docker buildx build --platform linux/arm64 -t ipmake/nevu:latest-arm64 . --push
77+
fi
4878
4979
- name: Build and push multi-platform Docker image
50-
run: docker buildx imagetools create --tag ipmake/nevu:latest ipmake/nevu:latest-amd64 ipmake/nevu:latest-arm64
80+
run: |
81+
if [ "${{ steps.extract_version.outputs.is_release }}" = "true" ]; then
82+
# Create versioned multi-platform image
83+
docker buildx imagetools create \
84+
--tag ipmake/nevu:${{ steps.extract_version.outputs.version }} \
85+
ipmake/nevu:${{ steps.extract_version.outputs.version }}-amd64 \
86+
ipmake/nevu:${{ steps.extract_version.outputs.version }}-arm64
87+
# Create latest multi-platform image
88+
docker buildx imagetools create \
89+
--tag ipmake/nevu:latest \
90+
ipmake/nevu:latest-amd64 \
91+
ipmake/nevu:latest-arm64
92+
else
93+
docker buildx imagetools create --tag ipmake/nevu:latest ipmake/nevu:latest-amd64 ipmake/nevu:latest-arm64
94+
fi

backend/src/index.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ discovery.announce("Nevu", {
5151
const proxy = httpProxy.createProxyServer({
5252
ws: true,
5353
autoRewrite: false,
54-
cookieDomainRewrite: (new URL(process.env.PLEX_SERVER as string)).hostname,
54+
cookieDomainRewrite: (new URL(process.env.PLEX_SERVER || "http://localhost:32400")).hostname,
5555
changeOrigin: true,
5656
secure: false,
5757
followRedirects: true,
@@ -109,16 +109,23 @@ const noVerifyHttpsAgent = new https.Agent({
109109
}
110110

111111
// check whether the PLEX_SERVER is reachable
112-
try {
113-
await axios.get(`${process.env.PLEX_SERVER}/identity`, {
114-
timeout: 5000,
115-
});
116-
} catch (error) {
117-
status.error = true;
118-
status.message = 'Proxy cannot reach PLEX_SERVER';
119-
console.error('Proxy cannot reach PLEX_SERVER');
120-
return;
121-
}
112+
await new Promise<void>(async (resolve) => {
113+
while (true) {
114+
const r = await axios.get(`${process.env.PLEX_SERVER ?? "http://localhost:32400"}/identity`, {
115+
timeout: 5000,
116+
}).catch(() => null);
117+
118+
if (r && r.status === 200) {
119+
status.error = false;
120+
return resolve();
121+
} else {
122+
status.error = true;
123+
status.message = 'Proxy cannot reach PLEX_SERVER';
124+
console.error('Proxy cannot reach PLEX_SERVER');
125+
await new Promise(r => setTimeout(r, 3000));
126+
}
127+
}
128+
})
122129
}
123130

124131

0 commit comments

Comments
 (0)