davidgsd / AllScan

AllStar Favorites Management & Scanning Web App
https://allscan.info
GNU General Public License v3.0
28 stars 5 forks source link

Add Favorite concatenates with previous line #3

Closed tomsalzer closed 1 year ago

tomsalzer commented 1 year ago

I installed via SSH as root into my ClearNode (HAMVoip), following the instructions at https://github.com/davidgsd/AllScan/commit/6eb555f208c22a0a19358bfb666f47ff814c025e. AllScan ran immediately with no other changes made. However, I see that when I add a favorite node through AllScan, the new node includes information from the preceding line in the table. See images at https://mega.nz/file/UW9U3YKQ#Ygk4p2WXqJ6SwCiReg_Wu_f3NrV6DKK9hQYpsH-h63k (I was connected through my ClearNode to another node) and https://mega.nz/file/Qf9j2RqL#SN00p_AZMzCDBATyLWjJ5S2CkRul6i9zjEyloOpiMs4 (not connected past my ClearNode).

The default install of AllScan on the ClearNode is in /srv/http/allscan as root:http. Supermon is also root:http. The supermon/favorites.ini file is 664 root:http.

I did restart Asterisk through the AllScan GUI, then tested by deleting a favorite and adding a favorite. The same behavior occurred. I don't know why the favorites.ini nodes as parsed in the rendered table are concatenating.

davidgsd commented 1 year ago

Hi Tom, Thanks for the report. It's hard to tell what might be going on from the screenshots, can you post here or email me (chc_media at yahoo.com) your favorites.ini file, and favorites.ini.bak file ? Once I see the file contents it should probably be clear what's going on and should be a quick fix. Thanks, David

tomsalzer commented 1 year ago

favorites.ini (labeled favorites.ini.tom): https://mega.nz/file/9HVmhDgC#JTQRfn-bZ2-eZVBu4sMpg9PqNnV0_5mus8F0titQ-qE

favorites.ini.bak (labeled favorites.ini.bak.tom): https://mega.nz/file/RWNFXazJ#jGkCnvn-yYFmIvCDE2bU7cn4g9ORpTXcYnNHVPICk5E

For what it's worth, I am seeing the same concatenation in the parsed table of favorites for entries that I did not enter via AllScan. Hmmm...

davidgsd commented 1 year ago

Hi Tom,

The issue is that your favorites.ini is not a validly formatted .ini file as required by Allmon, Supermon, or AllScan. .ini files are read directly by a php function into a data structure and this relies on the variables in the file following a certain structure.

Favorites in Allmon, Supermon, and AllScan are defined by pairs of { label[], cmd[] } entries. Every label[] = "..." line MUST be followed by a cmd[] = "..." line. Each label defines a favorite, but if no corresponding cmd[] follows it, the labels and commands in the file will become disassociated.

Your file has a couple of label[] = "---------------------------" lines that are not followed by a cmd[] line. If you have 2 label[] lines a row with no cmd[] line in-between the parse of the file will be incorrect.

To fix this, edit your favorites.ini file and for any lines that start with "label[] =" that do not have a "cmd[] = " line immediately below, add such a line below.

So in your file for example you have:

[general]

label[] = "PSRG AllStar Node 2462"
cmd[] = "rpt cmd %node% ilink *76*32462"

label[] = "---------------------------"

label[] = "Philadelphia AllStar HUB 27225"
cmd[] = "rpt cmd %node% ilink 13 27225"

To fix that, change it to:

[general]

label[] = "PSRG AllStar Node 2462"
cmd[] = "rpt cmd %node% ilink *76*32462"

label[] = "---------------------------"
cmd[] = " "

label[] = "Philadelphia AllStar HUB 27225"
cmd[] = "rpt cmd %node% ilink 13 27225"

You also have a similar section further down in the file:

; Example text non-action label field
; Adding a divider line
label[] = "----------------------------"
;label[] = "Edit Favorties.ini to add content"
;cmd[] = "NONE"

You should change that to:

; Example text non-action label field
; Adding a divider line

label[] = "----------------------------"
cmd[] = "NONE"

;label[] = "Edit Favorties.ini to add content"
;cmd[] = "NONE"

Note that lines that begin with a semicolon are just comments and have no effect.

Potentially AllScan could try to detect formatting errors such as that, however these kinds of issues would also cause problems in Allmon/Supermon so it's better for the user to make sure their .ini's are correctly formatted.

tomsalzer commented 1 year ago

Resolved. As I noodled on this matter this afternoon, I concluded it was my favorites.ini file that was at fault. I had written the following before I saw your excellent reply:

"My favorites.ini file had a label [] line with dashes to denote a divider. That label did not have a corresponding cmd [] associated with it. I think that threw every off below that point. Once I deleted the lonely divider line, the favorites table in AllScan parses normally. I added a link and it appears normal. So the problem was not with AllScan but with my favorites.ini file."

I can confirm that using the label:cmd pair with dashes in the label and an empty command doesn't muck things up. But I deleted the offending line anyway.

Apologies for consuming your bandwidth. This was my problem, not an issue with AllScan. Thus, I can confirm that it is working just fine "out of the box" using the default install commands as you have published, at least on my ClearNode which is currently up to date.