9
67
Fork
You've already forked Bolt
11

feature-app-news #12

Merged
Adamcake merged 10 commits from smithcol11/Bolt:feature-app-news into master 2026年01月12日 03:29:43 +01:00
Contributor
Copy link

Hello!

Been thinking of adding something like this for awhile and finally got the motivation to do so.
This adds the RSS news feeds for both osrs and rs3 into Bolt's UI.
I updated the screenshots so you can see how it looks at a glance.

Details:

  • Cache is currently stored in the browser local storage; maybe being stored by the backend in the data dir would be better? I wasn't sure what you prefer.
  • This will only attempt to update every six hours (don't want to be hammering their API). If it fails it just uses the cache.
  • I added a CMake presets file. This makes configuration and building/installing a bit easier, especially if you are using an IDE that supports this.
  • Made minor changes to the osrs settings page. The scrollbar at the default size bothered me, and the "disabled" button didn't look very disabled. These are fixed now.
  • Added a .clangd file which supports linting rules. Maybe having a .clang-tidy file would be better.

Let me know what you think.
Cheers

Hello! Been thinking of adding something like this for awhile and finally got the motivation to do so. This adds the RSS news feeds for both osrs and rs3 into Bolt's UI. I updated the screenshots so you can see how it looks at a glance. Details: - Cache is currently stored in the browser local storage; maybe being stored by the backend in the data dir would be better? I wasn't sure what you prefer. - This will only attempt to update every six hours (don't want to be hammering their API). If it fails it just uses the cache. - I added a CMake presets file. This makes configuration and building/installing a bit easier, especially if you are using an IDE that supports this. - Made minor changes to the osrs settings page. The scrollbar at the default size bothered me, and the "disabled" button didn't look very disabled. These are fixed now. - Added a `.clangd` file which supports linting rules. Maybe having a `.clang-tidy` file would be better. Let me know what you think. Cheers
- Frontend will fetch the appropriate news feed for either osrs or rs3, depending on the selected game.
- Store the XML and timestamp in the browser local storage.
- Fetch updates once every 6 hours; prefer local cache over fetching.
- Minor improvements to the osrs settings tab.
- Added CMake presets for easier setup.
- Added `.clangd` file for better linting.
Then, ran `bun minify` for prod files.
- Added a couple sections in the README about the CMake presets.
Author
Contributor
Copy link

Side tangent unrelated to this PR. I noticed you have a "zigify" branch.
Funny enough, I also started a branch that migrates the build system to Zig. I didn't realize you had a similar thought! Feel free to check it out (it isn't complete yet).

Side tangent unrelated to this PR. I noticed you have a "zigify" branch. Funny enough, I also started a branch that migrates the build system to Zig. I didn't realize you had a similar thought! Feel free to check it out (it isn't complete yet).

Thanks for doing this. It looks like a lot of extra code was added to support RSS feeds and I don't fully understand how clang is involved in javascript, or did you do it using native C++ code somehow?

The official launcher gets news from these URLs, or at least it did the last time I debugged it. Is there an advantage to doing it the way you've done it instead of via the URLs?

  • RS3: https://secure.runescape.com/m=news/latestNews.json?maxItems=6
  • OSRS: https://secure.runescape.com/m=news/latestNews.json?maxItems=6&oldschool=true

As for the layout (based on the new screenshots you added), it's good, but the "column" containing the play button feels a little cramped now. I think the main reason is just that it's not centered:
image
But it would be nice to give it a bit more space too and perhaps a visual separator.

Lastly there needs to be a setting to enable or disable the news feed. This is technically a tracking mechanism, and some people very strongly dislike telemetry - that's why I have the option to turn off PSAs as well.

Thanks for doing this. It looks like a lot of extra code was added to support RSS feeds and I don't fully understand how clang is involved in javascript, or did you do it using native C++ code somehow? The official launcher gets news from these URLs, or at least it did the last time I debugged it. Is there an advantage to doing it the way you've done it instead of via the URLs? - RS3: `https://secure.runescape.com/m=news/latestNews.json?maxItems=6` - OSRS: `https://secure.runescape.com/m=news/latestNews.json?maxItems=6&oldschool=true` As for the layout (based on the new screenshots you added), it's good, but the "column" containing the play button feels a little cramped now. I think the main reason is just that it's not centered: ![image](/attachments/2dc0df0c-7c46-4aca-ad9c-143e6d6214b7) But it would be nice to give it a bit more space too and perhaps a visual separator. Lastly there needs to be a setting to enable or disable the news feed. This is technically a tracking mechanism, and some people very strongly dislike telemetry - that's why I have the option to turn off PSAs as well.
Author
Contributor
Copy link

Thanks for checking it out!

I wouldn't say there is a lot of extra code here. Most of the relevant changes are in the news svelte files.
And to clarify, I do use the RSS URLs. they are just encoded. All the logic for getting and storing the feeds is done in the new svelte files. The other files touched on the app side were necessary changes to either get the feeds integrated, to fix linting and UX, or update dist.

No cpp files were added / changed. The mention of CMake and Clangd has to do with developer experience. Technically isn't necessary for this PR, but worthwhile additions. I could remove those files if you would like, but I think they should be in the repo at some point. The CMake presets so it is easier to change the build type and for a new dev to build the project. Also the .clangd for linting the cpp in the repo. That should maybe be changed out for a .clang-tidy file instead.

Good suggestions for the column spacing and the settings! I will fix the spacing and add a setting to remove the fetching of the feeds which will also recenter the launch options.

Thanks for checking it out! I wouldn't say there is a lot of extra code here. Most of the relevant changes are in the news svelte files. And to clarify, I do use the RSS URLs. they are just encoded. All the logic for getting and storing the feeds is done in the new svelte files. The other files touched on the app side were necessary changes to either get the feeds integrated, to fix linting and UX, or update `dist`. No cpp files were added / changed. The mention of CMake and Clangd has to do with developer experience. Technically isn't necessary for this PR, but worthwhile additions. I could remove those files if you would like, but I think they should be in the repo at some point. The CMake presets so it is easier to change the build type and for a new dev to build the project. Also the `.clangd` for linting the cpp in the repo. That should maybe be changed out for a `.clang-tidy` file instead. Good suggestions for the column spacing and the settings! I will fix the spacing and add a setting to remove the fetching of the feeds which will also recenter the launch options.
- Also changed out the `.clangd` for a `.clang-tidy`, as it is more fitting.
- Finally, ran `bun minify` so the app is ready for production.

Ah okay. So all the stuff relating to clang and gcc isn't needed to build your changes?

Ah okay. So all the stuff relating to clang and gcc isn't needed to build your changes?
Author
Contributor
Copy link

No, they aren't necessary for my changes; just useful in the repo overall.
I committed a fix for the spacing and added the setting! Let me know if you would like anything else changed.

No, they aren't necessary for my changes; just useful in the repo overall. I committed a fix for the spacing and added the setting! Let me know if you would like anything else changed.

The URL you're using isn't actually the same as the one I posted, but it does seem to have the same results encoded in xml instead of json, so that's probably fine.

These news URLs can take a noticeable amount of time to reply sometimes, which can cause the news for one game to be shown momentarily even though the other game is selected. It does correct itself after a moment, but it was enough to confuse me the first time it happened. Could we have a "loading" placeholder instead?

image

The URL you're using isn't actually the same as the one I posted, but it does seem to have the same results encoded in xml instead of json, so that's probably fine. These news URLs can take a noticeable amount of time to reply sometimes, which can cause the news for one game to be shown momentarily even though the other game is selected. It does correct itself after a moment, but it was enough to confuse me the first time it happened. Could we have a "loading" placeholder instead? ![image](/attachments/01bcf3f0-72fb-4be3-a8ff-60a592ef42b5)
188 KiB

I like that the two neighbouring news posts always have the same height, however, it's still possible for the two images to be misaligned from each other. Would it be possible to have the image anchored downwards instead of upwards?

image

I like that the two neighbouring news posts always have the same height, however, it's still possible for the two images to be misaligned from each other. Would it be possible to have the image anchored downwards instead of upwards? ![image](/attachments/02c9c46a-397c-4d00-9f43-faea86ce2aee)
120 KiB
- Simple pulse animation on empty cards while waiting for a respone.
- Also fixed a bug where it would fetch the feed even with the setting disabled.
-Also change the columns to two when the app shrinks in width, but only if the news is enabled.
Author
Contributor
Copy link

Okay I have added both the loading animation and aligned the images.

And yeah you are right about the URL, I guess I am used to using xml for RSS stuff. I can switch it to json if you would prefer?

Okay I have added both the loading animation and aligned the images. And yeah you are right about the URL, I guess I am used to using xml for RSS stuff. I can switch it to json if you would prefer?

Thanks again, just giving this another look over.

When clicking the news posts, please use /open-external-url to open a URL in the user's normal browser. Right now it opens the page in CEF, which is not only unexpected but I'm not sure the C++ code would necessarily handle it correctly. E.g.:

fetch('/open-external-url', { method: 'POST', body: 'https://bolt.adamcake.com/plugins' });

I also happened to notice this today - the PSA covers up the news posts, but the news posts kind of pop over the PSA while hovering the mouse over them. Is this intentional? Having both news and PSA at the same time is annoying and I guess this is fine as a workaround, it's better than nothing. But it feels like the PSA should be pinned above the news posts if that's possible?

image

Thanks again, just giving this another look over. When clicking the news posts, please use `/open-external-url` to open a URL in the user's normal browser. Right now it opens the page in CEF, which is not only unexpected but I'm not sure the C++ code would necessarily handle it correctly. E.g.: https://codeberg.org/Adamcake/Bolt/src/commit/21ea2bc819c0c6408422e9e93051111c3d11fba5/app/src/lib/Components/Modals/PluginModal.svelte#L233 I also happened to notice this today - the PSA covers up the news posts, but the news posts kind of pop over the PSA while hovering the mouse over them. Is this intentional? Having both news and PSA at the same time is annoying and I guess this is fine as a workaround, it's better than nothing. But it feels like the PSA should be pinned above the news posts if that's possible? ![image](/attachments/9f1d0ca1-5a05-4613-9428-2f9fe9fc5adf)
184 KiB

I can switch it to json if you would prefer?

I don't think there's any important difference, so whatever you have now is fine.

> I can switch it to json if you would prefer? I don't think there's any important difference, so whatever you have now is fine.
- Also fixed a bug where PSA content could be fetched multiple times by clicking on various app controls.
- Now PSA will only be fetched for each game once.
Author
Contributor
Copy link

I changed to opening the default browser using your provided fetch method.
Also moved the PSA to the messages section as a warning:

Screenshot_2026年01月05日_17-38-58

Let me know if you aren't a fan of that and we can come up with some other ideas. I was also thinking a toast notification that goes away after t seconds & can be closed early by the user. This would also get logged just in case.

I changed to opening the default browser using your provided fetch method. Also moved the PSA to the messages section as a warning: ![Screenshot_2026年01月05日_17-38-58](/attachments/a38766a4-762b-4151-aeeb-8521817a9375) Let me know if you aren't a fan of that and we can come up with some other ideas. I was also thinking a toast notification that goes away after t seconds & can be closed early by the user. This would also get logged just in case.
Author
Contributor
Copy link

Actually I changed it already, wasn't a huge fan of using the logger.
It also pulses, letting you know it is an alert of some kind.
Let me know what you think!

image

image

Actually I changed it already, wasn't a huge fan of using the logger. It also pulses, letting you know it is an alert of some kind. Let me know what you think! ![image](/attachments/deb47f15-78a0-4b95-8ed6-2800c01e587c) ![image](/attachments/a8ad024b-e229-4e51-9022-4da4dedc5eb6)

Yeah, I prefer the most recent version too.

Quick question that might not be related to this PR, but despite my best efforts, these PSA responses are still getting cached by the browser. This means sometimes no PSA is shown even when there actually is one, sometimes for up to an hour or so. Can we do anything about that? (Or did you already?) Ideally it should fetch the URL anew every single time.

Yeah, I prefer the most recent version too. Quick question that might not be related to this PR, but despite my best efforts, these PSA responses are still getting cached by the browser. This means sometimes no PSA is shown even when there actually is one, sometimes for up to an hour or so. Can we do anything about that? (Or did you already?) Ideally it should fetch the URL anew every single time.
Seems like a reasonable middle ground between everytime $effect gets triggered or once per app load.
Maybe could set it up on a timer so it fetches new PSAs without any user interaction at all.
Author
Contributor
Copy link

Yeah I started caching the PSA but wasn't fetching it frequent enough.
I changed it so it will try at most once per minute.

One thing to consider about the PSA is that it only ever fires inside the $effect in Launch.svelte. So, the user has to interact with the app in some way (change game tab, toggle a setting, etc) to trigger it. Which is maybe fine and preferred. Another idea is to simply put it on a timer that checks for a PSA every 1-n minutes or something.

Yeah I started caching the PSA but wasn't fetching it frequent enough. I changed it so it will try at most once per minute. One thing to consider about the PSA is that it only ever fires inside the `$effect` in `Launch.svelte`. So, the user has to interact with the app in some way (change game tab, toggle a setting, etc) to trigger it. Which is maybe fine and preferred. Another idea is to simply put it on a timer that checks for a PSA every 1-n minutes or something.

Ah that's not quite what I meant. I meant that this fetch request:

const url: string = `${bolt.env.psa_url}${gameName}/${gameName}.json`;
// added no-store due to an issue where new messages are not shown until cache is cleared.
// remote server appears to be using etags incorrectly?
fetch(url, { method: 'GET', cache: 'no-store' })

despite the no-store part, is sometimes getting cached by the browser instead of actually contacting the server each time. So sometimes it'll show no PSA even though there is one, and vice versa. This happens in between different bolt processes since the cache persists in CefCache. I'm just asking if you know of any way around that.

Ah that's not quite what I meant. I meant that this fetch request: https://codeberg.org/Adamcake/Bolt/src/commit/35d7b2eab74fad29197847b8fed47b9ea3fdf135/app/src/lib/Components/Launch.svelte#L37-L40 despite the no-store part, is sometimes getting cached by the browser instead of actually contacting the server each time. So sometimes it'll show no PSA even though there is one, and vice versa. This happens in between different bolt processes since the cache persists in `CefCache`. I'm just asking if you know of any way around that.
Author
Contributor
Copy link

Oh I see! I will look into that and see what I can do.

Oh I see! I will look into that and see what I can do.
add `?ts=${Date.now()}` to the URL. This seems to force a new fetch.
Author
Contributor
Copy link

Okay I think I fixed that. I added a query param to the URL, just a timestamp, to force it to be unique.
The end of the URL now has ?ts=${Date.now()}. This was now successfully updating the "Date" field in the header, therefore not using some browser cache or anything.

Okay I think I fixed that. I added a query param to the URL, just a timestamp, to force it to be unique. The end of the URL now has `?ts=${Date.now()}`. This was now successfully updating the "Date" field in the header, therefore not using some browser cache or anything.

All seems fine now, thanks.

All seems fine now, thanks.
smithcol11 deleted branch feature-app-news 2026年01月13日 05:50:57 +01:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Adamcake/Bolt!12
Reference in a new issue
Adamcake/Bolt
No description provided.
Delete branch "smithcol11/Bolt:feature-app-news"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?