mirror of
https://github.com/KarnerF/SMPlusGui.git
synced 2026-10-06 06:00:20 +02:00
Fix tile deeplink port: update param.json to 7777, patch port dynamically on install
This commit is contained in:
1 parent
8ecd374087
commit
4ed6869ad8
4 files changed
+14
-4
No files matched your search
+11
-1
@@ -51,7 +51,7 @@ static int write_file(const char *p, const uint8_t *d, size_t s) {
|
|||||||
return w == s ? 0 : -1;
|
return w == s ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void smplus_install_if_needed(int icon_always_front) {
|
void smplus_install_if_needed(int icon_always_front, int http_port) {
|
||||||
/* In once-only mode, skip if marker exists */
|
/* In once-only mode, skip if marker exists */
|
||||||
if(!icon_always_front) {
|
if(!icon_always_front) {
|
||||||
FILE *m = fopen(MARKER, "r");
|
FILE *m = fopen(MARKER, "r");
|
||||||
@@ -70,6 +70,16 @@ void smplus_install_if_needed(int icon_always_front) {
|
|||||||
mkdir(sdir, 0755);
|
mkdir(sdir, 0755);
|
||||||
|
|
||||||
if (write_file(par, sm_param_json, sm_param_json_size) != 0) goto done;
|
if (write_file(par, sm_param_json, sm_param_json_size) != 0) goto done;
|
||||||
|
/* patch deeplink port in the written param.json */
|
||||||
|
{FILE *pf=fopen(par,"r+");if(pf){
|
||||||
|
char buf[1024]={0};fread(buf,1,sizeof(buf)-1,pf);
|
||||||
|
char old_url[64],new_url[64];
|
||||||
|
snprintf(old_url,sizeof(old_url),"http://127.0.0.1:7777/");
|
||||||
|
snprintf(new_url,sizeof(new_url),"http://127.0.0.1:%d/",http_port>1024?http_port:7777);
|
||||||
|
char *pos=strstr(buf,old_url);
|
||||||
|
if(pos&&strlen(old_url)==strlen(new_url)){memcpy(pos,new_url,strlen(new_url));
|
||||||
|
fseek(pf,0,SEEK_SET);fwrite(buf,1,strlen(buf),pf);}
|
||||||
|
fclose(pf);}}
|
||||||
if (write_file(ico, sm_icon0_png, sm_icon0_png_size) != 0) goto done;
|
if (write_file(ico, sm_icon0_png, sm_icon0_png_size) != 0) goto done;
|
||||||
|
|
||||||
install_title_dir(TITLE_ID, APP_ROOT "/");
|
install_title_dir(TITLE_ID, APP_ROOT "/");
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#ifndef APP_INSTALLER_H
|
#ifndef APP_INSTALLER_H
|
||||||
#define APP_INSTALLER_H
|
#define APP_INSTALLER_H
|
||||||
void smplus_install_if_needed(int icon_always_front);
|
void smplus_install_if_needed(int icon_always_front, int http_port);
|
||||||
#endif
|
#endif
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"applicationCategoryType": 0,
|
"applicationCategoryType": 0,
|
||||||
"titleId": "SMPL00001",
|
"titleId": "SMPL00001",
|
||||||
"deeplinkUri": "http://127.0.0.1:7070/",
|
"deeplinkUri": "http://127.0.0.1:7777/",
|
||||||
"localizedParameters": {
|
"localizedParameters": {
|
||||||
"defaultLanguage": "de-DE",
|
"defaultLanguage": "de-DE",
|
||||||
"de-DE": {
|
"de-DE": {
|
||||||
|
|||||||
@@ -3265,7 +3265,7 @@ int payload_main(void) {
|
|||||||
{ SMPrefs _p; read_prefs(&_p); /* read icon pref once at start */
|
{ SMPrefs _p; read_prefs(&_p); /* read icon pref once at start */
|
||||||
while(1){
|
while(1){
|
||||||
mg_mgr_poll(&mgr,1000); usleep(100000);
|
mg_mgr_poll(&mgr,1000); usleep(100000);
|
||||||
if(++polls==3) smplus_install_if_needed(_p.icon_always_front);
|
if(++polls==3) smplus_install_if_needed(_p.icon_always_front, _p.http_port>1024?_p.http_port:7777);
|
||||||
/* send pending ELF after browser got its {ok:true} response */
|
/* send pending ELF after browser got its {ok:true} response */
|
||||||
if(smg_pending_elf[0]){ send_elf_to_elfldr(smg_pending_elf); smg_pending_elf[0]=0; }
|
if(smg_pending_elf[0]){ send_elf_to_elfldr(smg_pending_elf); smg_pending_elf[0]=0; }
|
||||||
if(polls==6 && !as_done){ /* ~6s after start — give elfldr time to initialize */
|
if(polls==6 && !as_done){ /* ~6s after start — give elfldr time to initialize */
|
||||||
|
|||||||
Reference in new issue
Block a user