added axLicense

This commit is contained in:
Marco Parodi
2024-06-25 11:05:22 -04:00
parent 0bf110bf08
commit 472c45385a
27 changed files with 348 additions and 29 deletions
+5
View File
@@ -0,0 +1,5 @@
{
"files.associations": {
"axlicense.h": "c"
}
}
+1
View File
@@ -1,5 +1,6 @@
#//Version=Native
AXIS_USABLE_LIBS = UCLIBC GLIBC
include libs/*/makefile.info
PROG = tailscale_vpn
Binary file not shown.
@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2020 Tailscale & AUTHORS.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+2 -1
View File
@@ -1 +1,2 @@
#define APP_NAME "tailscale_vpn"
#define APP_NAME "tailscale_vpn"
#define APP_ID 414812
+31
View File
@@ -0,0 +1,31 @@
#include <glib.h>
#include <licensekey.h>
#include <stdlib.h>
#include "../../app.h"
gboolean axLicense_checkLicense1()
{
//Verify license
const gchar* vmajor = NULL;
const gchar* vminor = NULL;
int version[2];
gboolean license_ok = FALSE;
int license = 0;
/* util-function for getting package.conf variables */
//ax_package_get("APPID", &appid);
//ax_package_get("APPNAME", &appname);
ax_package_get("APPMAJORVERSION", &vmajor);
ax_package_get("APPMINORVERSION", &vminor);
version[0] = atoi(vmajor);
version[1] = atoi(vminor);
/* licensekey_verify: Return 1 on success, 0 on failure. */
license = licensekey_verify(APP_NAME, APP_ID, version[0], version[1]);
license_ok = (license) ? TRUE : FALSE;
return license_ok;
}
+4
View File
@@ -0,0 +1,4 @@
//Version=1.0
/*{"Name":"License Key Installed?","Show":true, "Description":"Checks if a license key has been installed and validated"}*/
gboolean axLicense_checkLicense1();
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
PKGS += axpackage
SRCS += ./libs/axLicense/axLicense.c
LDLIBS += -Wl,-Bstatic,-llicensekey_stat,-Bdynamic,-llicensekey -ldl
+17 -10
View File
@@ -6,6 +6,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "./libs/axLicense/axLicense.h"
#include "app.h"
#define TAILSCALE_VPN "\
@@ -23,20 +24,26 @@ wait \n\
//****************/
/* main function */
//****************/
int main() {
/* Loop main (keeps the app running. without this part the app will start and stop right after) */
GMainLoop *main_loop;
main_loop = g_main_loop_new(NULL, FALSE);
GMainLoop *main_loop;
main_loop = g_main_loop_new(NULL, FALSE);
/* LOG app name (appname) */
syslog(LOG_INFO, "Starting %s", APP_NAME);
g_message("Starting %s",APP_NAME);
//check license
if (!axLicense_checkLicense1()){
syslog(LOG_ERR,"License key not installed. Exiting");
g_message("License key not installed. Exiting");
return 0;
}
system(TAILSCALE_VPN);
/* calling main loop */
g_main_loop_run(main_loop);
/* LOG app name (appname) */
syslog(LOG_INFO, "Starting %s", APP_NAME);
g_message("Starting %s",APP_NAME);
//run script
system(TAILSCALE_VPN);
/* calling main loop */
g_main_loop_run(main_loop);
//exit
return 0;
+4
View File
@@ -3,6 +3,7 @@
"acapPackageConf": {
"setup": {
"appName": "tailscale_vpn",
"appId":"414812",
"friendlyName": "Tailscale VPN",
"vendor": "Tailscale - Packaged by Mo3he",
"embeddedSdkVersion": "3.0",
@@ -10,6 +11,9 @@
"runMode": "once",
"version": "1.63.0"
},
"copyProtection": {
"method": "axis"
},
"configuration": {
"settingPage": "index.html"
}
+2 -2
View File
@@ -1,9 +1,9 @@
PACKAGENAME="Tailscale VPN"
APPTYPE="aarch64"
APPNAME="tailscale_vpn"
APPID=""
APPID="414812"
LICENSENAME="Available"
LICENSEPAGE="none"
LICENSEPAGE="axis"
VENDOR="Tailscale - Packaged by Mo3he"
REQEMBDEVVERSION="3.0"
APPMAJORVERSION="1"
+2
View File
@@ -1,4 +1,5 @@
APPNAME="tailscale_vpn"
APPID="414812"
PACKAGENAME="Tailscale VPN"
VENDOR="Tailscale - Packaged by Mo3he"
REQEMBDEVVERSION="3.0"
@@ -7,4 +8,5 @@ STARTMODE="once"
APPMAJORVERSION="1"
APPMINORVERSION="63"
APPMICROVERSION="0"
LICENSEPAGE="axis"
SETTINGSPAGEFILE="index.html"
+5
View File
@@ -0,0 +1,5 @@
#AARCH64
sudo docker run --rm -v /mnt/c/Users/mparodi/Documents/mySharedApps/Axis_Cam_Tailscale/aarch64/app:/opt/app/Axis_Cam_Tailscale -it axisecp/acap-native-sdk:1.14-aarch64
#ARMV7HF
sudo docker run --rm -v /mnt/c/Users/mparodi/Documents/mySharedApps/Axis_Cam_Tailscale/arm/app:/opt/app/Axis_Cam_Tailscale -it axisecp/acap-native-sdk:1.14-armv7hf
+1
View File
@@ -1,5 +1,6 @@
#//Version=Native
AXIS_USABLE_LIBS = UCLIBC GLIBC
include libs/*/makefile.info
PROG = tailscale_vpn
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2020 Tailscale & AUTHORS.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+2 -1
View File
@@ -1 +1,2 @@
#define APP_NAME "tailscale_vpn"
#define APP_NAME "tailscale_vpn"
#define APP_ID 414812
+31
View File
@@ -0,0 +1,31 @@
#include <glib.h>
#include <licensekey.h>
#include <stdlib.h>
#include "../../app.h"
gboolean axLicense_checkLicense1()
{
//Verify license
const gchar* vmajor = NULL;
const gchar* vminor = NULL;
int version[2];
gboolean license_ok = FALSE;
int license = 0;
/* util-function for getting package.conf variables */
//ax_package_get("APPID", &appid);
//ax_package_get("APPNAME", &appname);
ax_package_get("APPMAJORVERSION", &vmajor);
ax_package_get("APPMINORVERSION", &vminor);
version[0] = atoi(vmajor);
version[1] = atoi(vminor);
/* licensekey_verify: Return 1 on success, 0 on failure. */
license = licensekey_verify(APP_NAME, APP_ID, version[0], version[1]);
license_ok = (license) ? TRUE : FALSE;
return license_ok;
}
+4
View File
@@ -0,0 +1,4 @@
//Version=1.0
/*{"Name":"License Key Installed?","Show":true, "Description":"Checks if a license key has been installed and validated"}*/
gboolean axLicense_checkLicense1();
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
PKGS += axpackage
SRCS += ./libs/axLicense/axLicense.c
LDLIBS += -Wl,-Bstatic,-llicensekey_stat,-Bdynamic,-llicensekey -ldl
+17 -10
View File
@@ -6,6 +6,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "./libs/axLicense/axLicense.h"
#include "app.h"
#define TAILSCALE_VPN "\
@@ -23,20 +24,26 @@ wait \n\
//****************/
/* main function */
//****************/
int main() {
/* Loop main (keeps the app running. without this part the app will start and stop right after) */
GMainLoop *main_loop;
main_loop = g_main_loop_new(NULL, FALSE);
GMainLoop *main_loop;
main_loop = g_main_loop_new(NULL, FALSE);
/* LOG app name (appname) */
syslog(LOG_INFO, "Starting %s", APP_NAME);
g_message("Starting %s",APP_NAME);
//check license
if (!axLicense_checkLicense1()){
syslog(LOG_ERR,"License key not installed. Exiting");
g_message("License key not installed. Exiting");
return 0;
}
system(TAILSCALE_VPN);
/* calling main loop */
g_main_loop_run(main_loop);
/* LOG app name (appname) */
syslog(LOG_INFO, "Starting %s", APP_NAME);
g_message("Starting %s",APP_NAME);
//run script
system(TAILSCALE_VPN);
/* calling main loop */
g_main_loop_run(main_loop);
//exit
return 0;
+5 -1
View File
@@ -2,7 +2,8 @@
"schemaVersion": "1.6.0",
"acapPackageConf": {
"setup": {
"appName": "Tailscale_VPN",
"appName": "tailscale_vpn",
"appId":"414812",
"friendlyName": "Tailscale VPN",
"vendor": "Tailscale - Packaged by Mo3he",
"embeddedSdkVersion": "3.0",
@@ -10,6 +11,9 @@
"runMode": "once",
"version": "1.63.0"
},
"copyProtection": {
"method": "axis"
},
"configuration": {
"settingPage": "index.html"
}
+3 -3
View File
@@ -1,9 +1,9 @@
PACKAGENAME="Tailscale VPN"
APPTYPE="armv7hf"
APPNAME="Tailscale_VPN"
APPID=""
APPNAME="tailscale_vpn"
APPID="414812"
LICENSENAME="Available"
LICENSEPAGE="none"
LICENSEPAGE="axis"
VENDOR="Tailscale - Packaged by Mo3he"
REQEMBDEVVERSION="3.0"
APPMAJORVERSION="1"
+3 -1
View File
@@ -1,4 +1,5 @@
APPNAME="Tailscale_VPN"
APPNAME="tailscale_vpn"
APPID="414812"
PACKAGENAME="Tailscale VPN"
VENDOR="Tailscale - Packaged by Mo3he"
REQEMBDEVVERSION="3.0"
@@ -7,4 +8,5 @@ STARTMODE="once"
APPMAJORVERSION="1"
APPMINORVERSION="63"
APPMICROVERSION="0"
LICENSEPAGE="axis"
SETTINGSPAGEFILE="index.html"
+5
View File
@@ -0,0 +1,5 @@
#AARCH64
sudo docker run --rm -v /mnt/c/Users/mparodi/Documents/mySharedApps/Axis_Cam_Tailscale/aarch64/app:/opt/app/Axis_Cam_Tailscale -it axisecp/acap-native-sdk:1.14-aarch64
#ARMV7HF
sudo docker run --rm -v /mnt/c/Users/mparodi/Documents/mySharedApps/Axis_Cam_Tailscale/arm/app:/opt/app/Axis_Cam_Tailscale -it axisecp/acap-native-sdk:1.14-armv7hf