Skip to content

Commit 438a2bd

Browse files
hickeyaanon4
andauthored
Release 2.10.0 (#43)
* feat: discover zone name from /etc/config.mesh (#36) The zone name has traditionally been discovered by interogating /etc/config/services. The AREDN firmware is removing this file in favor of /etc/config.mesh/_setup.services.{dmz|nat}. This fix updates the location where the zone name is discovered. Signed-off-by: Gerard Hickey <[email protected]> Co-authored-by: Tim Wilkinson <[email protected]>
1 parent 3ef31dc commit 438a2bd

File tree

4 files changed

+149
-6
lines changed

4 files changed

+149
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build MeshChat API Package
2+
on:
3+
workflow_call:
4+
inputs:
5+
build_version:
6+
required: true
7+
type: string
8+
build_dir:
9+
required: true
10+
type: string
11+
12+
jobs:
13+
create-meshchat-api-package:
14+
runs-on: ubuntu-latest
15+
# container:
16+
# image: registry.gitlab.com/wt0f/gitlab-runner-images/shell:latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- run: echo ${{ inputs.build_version }} > VERSION
20+
- run: package/populate-meshchat-api-fs.sh ${{ inputs.build_dir }}
21+
- run: package/update-version.sh ${{ inputs.build_dir }}
22+
- run: package/ipk-build.sh ${{ inputs.build_dir }}
23+
- id: detect-package-file
24+
run: echo "file=$(ls -1 meshchat_*.ipk)" >> $GITHUB_OUTPUT
25+
- run: echo "${{ steps.detect-package-file.outputs.file }}"
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: ${{ steps.detect-package-file.outputs.file }}
29+
path: ${{ steps.detect-package-file.outputs.file }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build MeshChat Package
2+
on:
3+
workflow_call:
4+
inputs:
5+
build_version:
6+
required: true
7+
type: string
8+
build_dir:
9+
required: true
10+
type: string
11+
12+
jobs:
13+
create-meshchat-package:
14+
runs-on: ubuntu-latest
15+
# container:
16+
# image: registry.gitlab.com/wt0f/gitlab-runner-images/shell:latest
17+
outputs:
18+
package_file: ${{ steps.detect-package-file.outputs.file }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
# - run: info "Populating the filesystem with MeshChat files"
22+
- run: echo ${{ inputs.build_version }} > VERSION
23+
- run: package/populate-meshchat-fs.sh ${{ inputs.build_dir }}
24+
# - run: info "Updating version numbers to "
25+
- run: package/update-version.sh ${{ inputs.build_dir }}
26+
# - run: info "Packing up MeshChat files"
27+
- run: package/ipk-build.sh ${{ inputs.build_dir }}
28+
- id: detect-package-file
29+
run: echo "file=$(ls -1 meshchat_*.ipk)" >> $GITHUB_OUTPUT
30+
- run: echo "${{ steps.detect-package-file.outputs.file }}"
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: ${{ steps.detect-package-file.outputs.file }}
34+
path: ${{ steps.detect-package-file.outputs.file }}
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release MeshChat Package
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches: [release]
6+
7+
jobs:
8+
create-release:
9+
runs-on: ubuntu-latest
10+
# container:
11+
# image: registry.gitlab.com/wt0f/gitlab-runner-images/node:latest
12+
outputs:
13+
build_version: ${{ steps.detect_version.outputs.build_version }}
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.RELEASE_IT_TOKEN }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: git config
21+
run: |
22+
git config user.name "${GITHUB_ACTOR}"
23+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
24+
- run: npm install -g release-it @release-it/conventional-changelog @commitlint/config-conventional @commitlint/cli auto-changelog
25+
- id: detect_version
26+
run: echo "build_version=$(npx release-it --release-version)" >> $GITHUB_OUTPUT
27+
- run: npx release-it -VV --ci
28+
- run: git checkout master
29+
- run: git rebase release
30+
- run: git push
31+
32+
build-meshchat-package:
33+
needs: create-release
34+
uses:
35+
./.github/workflows/build-meshchat-package.yaml
36+
with:
37+
build_version: ${{ needs.create-release.outputs.build_version }}
38+
build_dir: package/meshchat-ipkg
39+
40+
build-meshchat-api-package:
41+
needs: create-release
42+
uses:
43+
./.github/workflows/build-meshchat-api-package.yaml
44+
with:
45+
build_version: ${{ needs.create-release.outputs.build_version }}
46+
build_dir: package/meshchat-ipkg
47+
48+
add-meshchat-package-to-release:
49+
needs:
50+
- build-meshchat-package
51+
- build-meshchat-api-package
52+
# container:
53+
# image: registry.gitlab.com/wt0f/gitlab-runner-images/node:latest
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
fetch-tags: true
60+
- run: git pull
61+
- run: npm install -g release-it @release-it/conventional-changelog @commitlint/config-conventional @commitlint/cli auto-changelog
62+
- uses: actions/download-artifact@v4
63+
with:
64+
name: ${{ needs.release_meshchat_package.outputs.package_file }}
65+
path: ${{ needs.release_meshchat_package.outputs.package_file }}
66+
- run: |
67+
for file in *.ipk; do
68+
echo "uploading $file"
69+
npx release-it --ci --no-increment --no-git --no-npm --github.update=true --github.assets=$file
70+
done
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.RELEASE_IT_TOKEN }}

src/data/www/cgi-bin/meshchatlib.lua

+14-6
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,19 @@ function node_name()
5656
end
5757

5858
function zone_name()
59-
for line in io.lines("/etc/config/services")
60-
do
61-
local zone = line:match(":8080/meshchat|tcp|(.+)")
62-
if zone then
63-
return zone
59+
local dmz_mode = uci.cursor("/etc/config.mesh"):get("aredn", "@dmz[0]", "mode")
60+
local servfile = "/etc/config.mesh/_setup.services.nat"
61+
-- LAN mode is not set to NAT
62+
if dmz_mode ~= "0" then
63+
servfile = "/etc/config.mesh/_setup.services.dmz"
64+
end
65+
if nixio.fs.access(servfile) then
66+
for line in io.lines(servfile)
67+
do
68+
local zone = line:match("^(.*)|.*|.*|.*|.*|meshchat$")
69+
if zone then
70+
return zone
71+
end
6472
end
6573
end
6674
return "MeshChat"
@@ -220,5 +228,5 @@ function node_list()
220228
end
221229

222230
function str_escape(str)
223-
return str:gsub("%(", "%%("):gsub("%)", "%%)"):gsub("%%", "%%%%"):gsub("%.", "%%."):gsub("%+", "%%+"):gsub("-", "%%-"):gsub("%*", "%%*"):gsub("%[", "%%["):gsub("%?", "%%?"):gsub("%^", "%%^"):gsub("%$", "%%$")
231+
return str:gsub("%(", "%%("):gsub("%)", "%%)"):gsub("%%", "%%%%"):gsub("%.", "%%."):gsub("%+", "%%+"):gsub("-", "%%-"):gsub("%*", "%%*"):gsub("%[", "%%["):gsub("%?", "%%?"):gsub("%^", "%%^"):gsub("%$", "%%$")
224232
end

0 commit comments

Comments
 (0)