#updater
277 messages Β· Page 1 of 1 (latest)
my updater kind of works but it can't get direct download of my gh release
debug it
take a look why the download URL isn't set
e.g. do you get the correct response from the api?
it's because of redirects
what redirects?
// Construct direct download URL from tag_name
+ char downloadUrlBuffer[512];
+ sprintf_s(downloadUrlBuffer, 512, "https://github.com/%s/releases/download/%s/noteplus.exe", GITHUB_REPO, tagStart);
+ char *downloadUrl = _strdup(downloadUrlBuffer);```
`https://github.com/owner/repo/releases/latest/download/app.exe
https://api.github.com/repos/owner/repo/releases/latest`
Those are samples only, but to give you an idea what what redirects look like.
you mean this?
yes
any clue?
idk actually
@mint storm
new code but didnt wor
@blazing vector has reached level 4. GG!
k
// Update available - parse assets for download URL
+ char *assetsStart = strstr(response, "\"assets\":[");
+ char *downloadUrl = NULL;
+ if (assetsStart) {
+ // Find assets and look for noteplus.exe specifically
+ char *asset = assetsStart;
+ while ((asset = strstr(asset, "\"name\":\"")) != NULL) {
+ asset += strlen("\"name\":\"");
+ char *nameEnd = strchr(asset, '\"');
+ if (!nameEnd) break;
+ *nameEnd = '\0';
+ if (strcmp(asset, "noteplus.exe") == 0) {
+ // Found noteplus.exe, now find browser_download_url
+ char *urlAsset = strstr(nameEnd + 1, "\"browser_download_url\":\"");
+ if (urlAsset) {
+ urlAsset += strlen("\"browser_download_url\":\"");
+ char *urlEnd = strchr(urlAsset, '\"');
+ if (urlEnd) {
+ *urlEnd = '\0';
+ downloadUrl = _strdup(urlAsset);
+ break;
+ }
+ }
+ }
+ asset = nameEnd + 1;
+ }
+ ]```
the new location is in the response headers
how about this? #1439663605393129674 message
let me end the new one
that previous one is cancerous
what are you even trying with that
redirects
by doing what exactly?
parsing the assets array for the browser_download_url
wasn't your problem the redirect?
vscode kinda does it like that in some ways
yes
how does that solve it?
i am just trying different ways to solve it
but yeah my issue is ith the redirect
what
is this an issue or just a best practice related topic
how would that solve your problem
only a issue if your exe file in the release isn't noteplus.exe because your code specifically searches for noteplus.exe
in the gh asset yes
maybe dont jump around multiple issues, that's very confusing
solve one issue and then the next
sure sure
how to solve the first one
yi combinateit with this code right #1439663605393129674 message
right?
i don't get it lol
like
follows redirects to get the actual location from the "new" field in
the response headers.
?
if yes i did try that and it didn't work
wdym with "didn't work"?
what's the problem?
this one that gets invoked
hm
@mint storm
i got it working
but
but what?
i fixed the download thing
but overwrites the existing exe
is fucked up
sure
π
so how are you planning to solve that?
no idea
i used the CopyFileW
but uh
:\
currently you have a noteplus.exe that is opened and you download a new version of it and you want to replace the old one with the new one
think of a possible solution
do you understand why it's currently technically not working?
a batch injection code
that kills the obsolete exe
and replaces with the new one
something like that is a possible solution yeah
i did it
@blazing vector has reached level 5. GG!
but it works like shit
whats the problem?
sprintf(batchContent,
":loop\n"
"tasklist /FI \"IMAGENAME eq noteplus.exe\" | find /I \"noteplus.exe\" >nul\n"
"if not errorlevel 1 (\n"
" timeout /t 1 /nobreak >nul\n"
" goto loop\n"
")\n"
"move /Y \"%s\" \"%s\"\n"
"start \"\" \"%s\"\n"
"del \"%%~f0\"\n",
tempExe, exeA, exeA
);```
what do you do with it?
what does that show me?
ah shit my trick didn't work
- Downloads exe from temp
- batch inject to force kill the app and copies the nw one
- delete traces
the batch doesn't even get executed
the problem is it's downloading FINE
the copying is corrupted
its like
i t copies half of it
i am going insane
i swear
THE APP IS JUST A FEWJBS
@mint storm pls help
i get hit with compatibility error
does it work when you download it through your browser from gh?
it works fine
ah
copying from noteplus_new.exe to noteplus.exe?
yes
but it renames it
yk
what do you mean by that then? isn't the batch doing the copying?
yes
it copies it wrong
@mint storm
@silver crystal can u please help me with installation process?
@blazing vector has reached level 6. GG!
I fixed the download process
I kindly asked for help
The script i made doesn't copy the updated exe properly
can you explain what your issue is?
i made an updater for my notepad , the updater manage to get the exe from github but the copying isn't working perfectly on it
I'm going to need more info than that, there's literally nothing I could do or say only based on that info
the code?
and what the problem is
big code snippets should be shared using pastebin/git or some other kind of online sharing service
ipba
n
i can't
why not?
ipban?
you got ipban on every online sharing service that exists?
let me send u the file from my gh repo
alright, so what's the issue
updater doesn't copy the updated exe properly but instead it creates a corrupted exe file
what have you tried so far
tried the trick of using batch file
tried making the exe writes new bin date by itself and reboots but it was worse
the file size gets huge
1gb exe
have you tried running the batch manually or running the commands by hand?
i did yes
but it still gives corrupted exe
alright then your issue is not with your code it's with your commands
did you try the .bat or the commands?
both
can you show the commands you ran exactly
the manual one? via cmd?
uhhh
yes
i forgot the commands
yeah, can you show them?
I'm asking to see the commands you ran, not your C code
the bracket
:loop
tasklist /FI "IMAGENAME eq noteplus.exe" | find /I "noteplus.exe" >nul
if not errorlevel 1 (
timeout /t 1 /nobreak >nul
goto loop
)
move /Y "C:\path\temp.exe" "C:\path\noteplus.exe"
start "" "C:\path\noteplus.exe"
you're doing your things in the C:\path\?
yes , in stable code it does it in temp folder
the windows's temp folder
have you tried just running move /Y "C:\path\temp.exe" "C:\path\noteplus.exe"
yes
and that doesn't work either?
noΓΉ
LMAO
@blazing vector has reached level 7. GG!
@blazing vector don't upload binaries here
i am setting to record a video
that's fine
I just tried the command and it worked for me
π
(can't be executed)
ok but I don't know what you did to get that
afte using the move cmd π
can you give a step by step of what you are doing exactly
i am having a doubt with my download method ...
did you try running the file before the copy/move...
no
wait wait a minute
the size
the updated exe size is 282 kb
what about the size
the one in release is just a bit smaller
I don't know what you are talking about
ko is not the same as kb
ah yeah right
guess what
I just tried this with your executable and it worked
what did u try
there's probably a problem with your download
download notepad.exe
the updater works?
copy it to C:\path
run it
rename to temp.exe
run move /Y "C:\path\temp.exe" "C:\path\noteplus.exe"
run it again
and it worked
no
there is still an issue
the downloaded exe file that is from cache is corrupted
you're downloading the html page lmao
https://github.com/etyuiudfvgg-source/noteplus/blob/main/src/updater.c#L37
so what's the generated link?
that you actually download
π
htmurl ....
yes can you print the actual link?
1min to debug
but it's htmurl obj
idk what that means
wait i have to ensure the URL points to the actual executable file ( the browser_download_url from GitHub assets)?
idk what that means
Confirm Download URL
X
?
Download URL:
https://github.com/etyuiudfvgg-source/noteplus/releases/download/1.1.0/noteplus.exe
Do you want to proceed with the download?
Oui
Non
that url is not correct
wharra do
idk what that means
what to do
fix the url lol
i have no idea, the constants are not wrong and like
where did you get that URL?
i followed the gh docs π
link?
base url plusrepo path plus
I mean, do you have the url to the doc you followed?
that's a link to the API
I don't see where it tells you how to construct a download URL
you're missing the v in front of v1.1.0
oh
it's workinggggg
also are u familiar with batch?
somewhat
like, it doesn't show that the bbuild is successful
it just show Building Noteplus and then exits
that's horendous
(to silence some noisy shit)
ohh ifixed it
but uhhh
howto deal with broken pipe error from windres