Skip to content

Commit 23a6463

Browse files
authored
Merge pull request #49 from GalaxyPay/dev
func updates
2 parents 9c9eccb + 3b3de8c commit 23a6463

File tree

12 files changed

+105
-23
lines changed

12 files changed

+105
-23
lines changed

.github/workflows/go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,5 +266,5 @@ jobs:
266266
uses: ncipollo/release-action@v1
267267
with:
268268
allowUpdates: true
269-
tag: v3.1.2
269+
tag: v3.2.0
270270
artifacts: "Output/*"

FUNC.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "FUNC"
5-
#define MyAppVersion "3.1.2"
5+
#define MyAppVersion "3.2.0"
66
#define MyAppPublisher "Galaxy Pay, LLC"
77
#define MyAppPublisherURL "https://galaxy-pay.com"
88
#define MyPublishPath "publish"

FUNC/Controllers/FuncController.cs

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Runtime.InteropServices;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Octokit;
4+
using static System.OperatingSystem;
5+
6+
namespace FUNC.Controllers
7+
{
8+
[ApiController]
9+
[Route("[controller]")]
10+
public class FuncController(ILogger<FuncController> logger) : ControllerBase
11+
{
12+
private readonly ILogger<FuncController> _logger = logger;
13+
14+
// GET: func/latest
15+
[HttpGet("latest")]
16+
public async Task<ActionResult<string>> FuncLatest()
17+
{
18+
try
19+
{
20+
string workspaceName = "GalaxyPay";
21+
string repositoryName = "func";
22+
var client = new GitHubClient(new ProductHeaderValue(repositoryName));
23+
var latestInfo = await client.Repository.Release.GetLatest(workspaceName, repositoryName);
24+
25+
string? pattern = IsWindows() ? "windows"
26+
: IsLinux() ? (RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "linux-arm64" : "linux-amd64")
27+
: IsMacOS() ? (RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "darwin-arm64" : "darwin-amd64")
28+
: null;
29+
30+
if (pattern == null) return BadRequest();
31+
var asset = latestInfo?.Assets.FirstOrDefault(a => a.Name.Contains(pattern));
32+
if (asset == null) return BadRequest();
33+
return asset.BrowserDownloadUrl;
34+
}
35+
catch (Exception ex)
36+
{
37+
return BadRequest(ex.Message);
38+
}
39+
}
40+
}
41+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ When updating a previous installation, the installer will recommend to let it au
2525
After downloading the `.pkg` file to your machine, run
2626

2727
```sh
28-
sudo installer -pkg func_<version>_darwin-<architecture>.pkg -target /
28+
sudo installer -target / -pkg func_<version>_darwin-<architecture>.pkg
2929
```
3030

3131
If instead you wish to install the package by double-clicking the `.pkg` file , you will have to follow [these instuctions](https://support.apple.com/guide/mac-help/apple-cant-check-app-for-malicious-software-mchleab3a043/mac) for bypassing unsigned packages:

create-package-deb.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
rm -r Output
22

3-
PKG=Output/func_3.1.2_linux-$1
3+
PKG=Output/func_3.2.0_linux-$1
44

55
mkdir -p $PKG/lib/systemd/system
66
mkdir -p $PKG/opt/func

create-package-pkg.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ pkgbuild --root publish \
55
--install-location /opt/func \
66
--scripts pkg/scripts \
77
--identifier func.app \
8-
Output/func_3.1.2_darwin-$1.pkg
8+
Output/func_3.2.0_darwin-$1.pkg

deb/amd64/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: func
2-
Version: 3.1.2
2+
Version: 3.2.0
33
Section: base
44
Priority: optional
55
Architecture: amd64

deb/arm64/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: func
2-
Version: 3.1.2
2+
Version: 3.2.0
33
Section: base
44
Priority: optional
55
Architecture: arm64

webui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "func-webui",
3-
"version": "3.1.2",
3+
"version": "3.2.0",
44
"scripts": {
55
"dev": "vite",
66
"build": "vite build",

webui/src/components/AppBar.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
<v-btn icon @click="showSettings = true">
1010
<v-icon
1111
:icon="mdiCog"
12-
:color="store.updateAvailable && !store.downloading ? 'warning' : ''"
12+
:color="
13+
(store.nodeUpdateAvailable || store.funcUpdateAvailable) &&
14+
!store.downloading
15+
? 'warning'
16+
: ''
17+
"
1318
/>
1419
<v-tooltip text="Settings" activator="parent" location="bottom" />
1520
</v-btn>

webui/src/components/Settings.vue

+48-13
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,44 @@
77
<v-icon color="currentColor" :icon="mdiClose" @click="show = false" />
88
</v-card-title>
99
<v-container>
10+
<v-row align="center">
11+
<v-col>
12+
<div>FUNC Version</div>
13+
<div class="text-caption text-grey">
14+
{{ appVersion }}
15+
{{ !store.funcUpdateAvailable ? "(latest)" : "" }}
16+
</div>
17+
</v-col>
18+
<v-col class="text-right">
19+
<v-btn
20+
:color="url ? 'warning' : ''"
21+
variant="tonal"
22+
:disabled="!url"
23+
:href="url"
24+
>
25+
Download
26+
<v-tooltip
27+
activator="parent"
28+
location="left"
29+
:text="`Download ${funcLatest}`"
30+
/>
31+
</v-btn>
32+
</v-col>
33+
</v-row>
1034
<v-row align="center">
1135
<v-col>
1236
<div>Node Version</div>
1337
<div class="text-caption text-grey">
1438
{{ store.goalVersion?.installed }}
39+
{{ !store.nodeUpdateAvailable ? "(latest)" : "" }}
1540
</div>
1641
</v-col>
1742
<v-col class="text-right">
1843
<v-btn
19-
:color="store.updateAvailable ? 'warning' : ''"
44+
:color="store.nodeUpdateAvailable ? 'warning' : ''"
2045
variant="tonal"
21-
:disabled="!store.updateAvailable || store.downloading"
22-
@click="updateLatest()"
46+
:disabled="!store.nodeUpdateAvailable || store.downloading"
47+
@click="updateNodeLatest()"
2348
>
2449
Update
2550
<v-tooltip
@@ -28,7 +53,6 @@
2853
:text="`Update to ${store.goalVersion?.latest}`"
2954
/>
3055
</v-btn>
31-
<Releases class="ml-2" @release="updateRelease" />
3256
</v-col>
3357
</v-row>
3458
<v-row align="center">
@@ -72,28 +96,39 @@ const show = computed({
7296
},
7397
});
7498
99+
const appVersion = __APP_VERSION__;
100+
const funcLatest = ref();
101+
const url = ref();
75102
let init = false;
76103
77-
onBeforeMount(() => {
104+
onBeforeMount(async () => {
78105
if (activeNetwork.value !== "mainnet") setShowNetworks(true);
79-
getVersion();
106+
await getVersion();
107+
if (store.funcUpdateAvailable) {
108+
url.value = (await FUNC.api.get("func/latest")).data;
109+
}
80110
});
81111
82112
async function getVersion() {
83113
try {
84-
const version = await FUNC.api.get("goal/version");
85-
store.goalVersion = version.data;
114+
const func = await axios({
115+
url: "https://api.github.com/repos/GalaxyPay/func/releases/latest",
116+
});
117+
funcLatest.value = func.data?.name.slice(1);
118+
store.funcUpdateAvailable = funcLatest.value !== appVersion;
119+
const goalVersion = await FUNC.api.get("goal/version");
120+
store.goalVersion = goalVersion.data;
86121
if (store.goalVersion?.installed) store.ready = true;
87122
else {
88123
if (!init) {
89124
init = true;
90-
updateLatest(true);
125+
updateNodeLatest(true);
91126
} else {
92127
throw Error("Download Failed");
93128
}
94129
}
95130
96-
store.updateAvailable =
131+
store.nodeUpdateAvailable =
97132
!!store.goalVersion?.latest &&
98133
store.goalVersion?.latest !== store.goalVersion?.installed;
99134
} catch (err: any) {
@@ -102,16 +137,16 @@ async function getVersion() {
102137
}
103138
}
104139
105-
async function updateLatest(bypass = false) {
140+
async function updateNodeLatest(bypass = false) {
106141
if (
107142
!bypass &&
108143
!confirm("Are you sure you want to update your node to the latest version?")
109144
)
110145
return;
111-
await updateRelease("latest");
146+
await updateNode("latest");
112147
}
113148
114-
async function updateRelease(release: string) {
149+
async function updateNode(release: string) {
115150
try {
116151
store.downloading = true;
117152
store.stopNodeServices = true;

webui/src/stores/app.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const useAppStore = defineStore("app", {
1515
refresh: 0,
1616
connectMenu: false,
1717
stopNodeServices: false,
18-
updateAvailable: false,
18+
funcUpdateAvailable: false,
19+
nodeUpdateAvailable: false,
1920
downloading: false,
2021
stoppingReti: false,
2122
goalVersion: undefined as GoalVersion | undefined,

0 commit comments

Comments
 (0)