Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] docs/website: fixing js for the new feed source
@ 2022-09-25 16:03 Angelo Compagnucci
  2022-09-25 19:41 ` Thomas Petazzoni
  2023-02-06 10:02 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 5+ messages in thread
From: Angelo Compagnucci @ 2022-09-25 16:03 UTC (permalink / raw)
  To: buildroot; +Cc: Angelo Compagnucci

Feed source is moved to a local atom file available on the web server to
remove further problems with unreliable feed sources.
Moving the feed required a bit of refactor of the load_activity function
so it won't download two times te same url.

This change requires a cron job like this enabled on the website:
* * * * * wget -O new.atom https://lore.kernel.org/buildroot/new.atom

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 docs/website/js/buildroot.js | 70 ++++++++++++++++++++----------------
 1 file changed, 40 insertions(+), 30 deletions(-)

diff --git a/docs/website/js/buildroot.js b/docs/website/js/buildroot.js
index bf80f11d7a..288e3e745c 100644
--- a/docs/website/js/buildroot.js
+++ b/docs/website/js/buildroot.js
@@ -1,39 +1,50 @@
-function load_activity(feedurl, divid) {
-    let container = document.getElementById(divid);
+function display_activity(result, activity) {
+    let loaded = 0;
+    let nb_display = 8;
+    let container;
+    if (result==null) return;
+    for (let i = 0; i < result.feed.entry.length; i++) {
+        let entry = result.feed.entry[i];
+        if (activity==="commit" && entry.title.toString().indexOf("git commit") !== -1) {
+            container = document.getElementById("commit-activity");
+        } else if (activity==="mailing-list" && entry.title.toString().indexOf("git commit") === -1) {
+            container = document.getElementById("mailing-list-activity");
+        } else {
+            continue;
+        }
+        loaded += 1
+        if (loaded > nb_display)
+            break;
+        let div = document.createElement("p");
+        let link = document.createElement("a");
+        let d = new Date(entry.updated);
+        let data = '[' + d.toLocaleDateString() + '] ' + entry.title;
+        let text = document.createTextNode(data);
+        link.appendChild(text);
+        link.title = entry.title;
+        link.href = entry.link._href;
+        div.appendChild(link);
+        container.appendChild(div);
+    }
+    for (let i = 0; i < (nb_display - loaded); i++) {
+        container.appendChild(document.createElement("p"));
+    }
+}
+
+function load_activity(feedurl) {
     $.ajax({
-      url: "https://cors-anywhere.herokuapp.com/" + feedurl
+      url: feedurl
     })
     .done(function(data){
         let x2js = new X2JS();
         let result = x2js.xml_str2json(data.documentElement.outerHTML);
-        let loaded = 0;
-        let nb_display = 8;
-        if (result==null) return;
-        for (let i = 0; i < result.feed.entry.length; i++) {
-            let entry = result.feed.entry[i];
-            if (entry.title.indexOf("git commit") !== -1)
-                continue;
-            loaded += 1;
-            if (loaded > nb_display)
-                break;
-            let div = document.createElement("p");
-            let link = document.createElement("a");
-            let d = new Date(entry.published);
-            let data = '[' + d.toLocaleDateString() + '] ' + entry.title;
-            let text = document.createTextNode(data);
-            link.appendChild(text);
-            link.title = entry.title;
-            link.href = entry.link._href;
-            div.appendChild(link);
-            container.appendChild(div);
-        }
-        let empty = nb_display - loaded;
-        for (let i = 0; i < empty; i++) {
-            container.appendChild(document.createElement("p"));
-        }
+        display_activity(result, "commit");
+        display_activity(result, "mailing-list");
     });
 }
 
+
+
 function google_analytics() {
     let _gaq = _gaq || [];
     _gaq.push(['_setAccount', 'UA-21761074-1']);
@@ -86,8 +97,7 @@ jQuery(document).ready(function($) {
     url = url.split(/[\\/]/).pop();
     $('.nav a[href="/' + url + '"]').parent().addClass('active');
 
-    load_activity("http://buildroot-busybox.2317881.n4.nabble.com/Buildroot-busybox-ft2.xml", "mailing-list-activity");
-    load_activity("http://git.buildroot.org/buildroot/atom/?h=master", "commit-activity");
+    load_activity("/new.atom");
 
     $('#slides').html('<iframe src="https://docs.google.com/gview?url=http://bootlin.com/doc/training/buildroot/buildroot-slides.pdf&embedded=true" style="position:absolute; width:100%; height:100%; top:0; left:0;" frameborder="0"></iframe>')
 });
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] docs/website: fixing js for the new feed source
  2022-09-25 16:03 [Buildroot] [PATCH] docs/website: fixing js for the new feed source Angelo Compagnucci
@ 2022-09-25 19:41 ` Thomas Petazzoni
  2022-10-03 15:25   ` Angelo Compagnucci
  2023-02-06 10:02 ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 19:41 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: buildroot

Hello Angelo,

On Sun, 25 Sep 2022 18:03:20 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> Feed source is moved to a local atom file available on the web server to
> remove further problems with unreliable feed sources.
> Moving the feed required a bit of refactor of the load_activity function
> so it won't download two times te same url.
> 
> This change requires a cron job like this enabled on the website:
> * * * * * wget -O new.atom https://lore.kernel.org/buildroot/new.atom

Thanks a lot for working on this. Based on the cron job like that you
propose, I can see how this can fix the list of last e-mails on the
mailing list, but how can that fix the other box visible on the web
site, which lists the latest commits ?

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] docs/website: fixing js for the new feed source
  2022-09-25 19:41 ` Thomas Petazzoni
@ 2022-10-03 15:25   ` Angelo Compagnucci
  2022-10-03 15:45     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 5+ messages in thread
From: Angelo Compagnucci @ 2022-10-03 15:25 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot


[-- Attachment #1.1: Type: text/plain, Size: 1413 bytes --]

On Sun, Sep 25, 2022 at 9:41 PM Thomas Petazzoni <
thomas.petazzoni@bootlin.com> wrote:

> Hello Angelo,
>
> On Sun, 25 Sep 2022 18:03:20 +0200
> Angelo Compagnucci <angelo@amarulasolutions.com> wrote:
>
> > Feed source is moved to a local atom file available on the web server to
> > remove further problems with unreliable feed sources.
> > Moving the feed required a bit of refactor of the load_activity function
> > so it won't download two times te same url.
> >
> > This change requires a cron job like this enabled on the website:
> > * * * * * wget -O new.atom https://lore.kernel.org/buildroot/new.atom
>
> Thanks a lot for working on this. Based on the cron job like that you
> propose, I can see how this can fix the list of last e-mails on the
> mailing list, but how can that fix the other box visible on the web
> site, which lists the latest commits ?
>

This feed mixes commit/non commit entries, so the choice on which box fill
up is in the js code.


>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
>


-- 

Angelo Compagnucci

Software Engineer

angelo@amarulasolutions.com
__________________________________
Amarula Solutions SRL

Via le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 (0)42 243 5310
info@amarulasolutions.com

www.amarulasolutions.com
[`as] https://www.amarulasolutions.com|

[-- Attachment #1.2: Type: text/html, Size: 5976 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] docs/website: fixing js for the new feed source
  2022-10-03 15:25   ` Angelo Compagnucci
@ 2022-10-03 15:45     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-10-03 15:45 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: buildroot

On Mon, 3 Oct 2022 17:25:18 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> > Thanks a lot for working on this. Based on the cron job like that you
> > propose, I can see how this can fix the list of last e-mails on the
> > mailing list, but how can that fix the other box visible on the web
> > site, which lists the latest commits ?
> 
> This feed mixes commit/non commit entries, so the choice on which box fill
> up is in the js code.

Aaah, it uses the git commit notifications available in the mailing
list. Smart thing!

Thanks for this contribution. We'll have a look at setting it up, with
the cronjob that it requires.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] docs/website: fixing js for the new feed source
  2022-09-25 16:03 [Buildroot] [PATCH] docs/website: fixing js for the new feed source Angelo Compagnucci
  2022-09-25 19:41 ` Thomas Petazzoni
@ 2023-02-06 10:02 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-02-06 10:02 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: buildroot

On Sun, 25 Sep 2022 18:03:20 +0200
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> Feed source is moved to a local atom file available on the web server to
> remove further problems with unreliable feed sources.
> Moving the feed required a bit of refactor of the load_activity function
> so it won't download two times te same url.
> 
> This change requires a cron job like this enabled on the website:
> * * * * * wget -O new.atom https://lore.kernel.org/buildroot/new.atom
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
>  docs/website/js/buildroot.js | 70 ++++++++++++++++++++----------------
>  1 file changed, 40 insertions(+), 30 deletions(-)

Finally applied, now that the cronjob is in place on the server! Thanks
a lot for your contribution and patience!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-06 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-25 16:03 [Buildroot] [PATCH] docs/website: fixing js for the new feed source Angelo Compagnucci
2022-09-25 19:41 ` Thomas Petazzoni
2022-10-03 15:25   ` Angelo Compagnucci
2022-10-03 15:45     ` Thomas Petazzoni via buildroot
2023-02-06 10:02 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox