diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..28ecad0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,60 @@ +# Shell Scripts +*.bat eol=crlf +*.sh eol=lf + +# Sources +*.groovy eol=lf +*.java eol=lf + +# Configuration +*.dtd eol=lf +*.ini eol=lf +*.json eol=lf +*.mod eol=lf +*.properties eol=lf +*.sql eol=lf +*.xsl eol=lf +*.xslt eol=lf +*.xml eol=lf +*.yaml eol=lf +*.yml eol=lf + +# Text / Documentation +*.adoc eol=lf +*.dot eol=lf +*.txt eol=lf +*.TXT eol=lf +*.md eol=lf +*.pdf binary + +# Web +*.gif binary +*.htm eol=lf +*.html eol=lf +*.ico binary +*.jar binary +*.jpg binary +*.jpeg binary +*.js eol=lf +*.jsp eol=lf +*.jspf eol=lf +*.png binary +*.svg eol=lf +*.svgz binary +*.tga binary +*.tif binary +*.tiff binary +*.ttf binary +*.war binary + +# Build Files +Jenkinsfile eol=lf + +# Binaries +*.raw binary +*.gz binary +*.zip binary +*.br binary +*.brotli binary +*.bz2 binary + diff --git a/home/modules/ROOT/pages/download.adoc b/home/modules/ROOT/pages/download.adoc index 285011e..482a5c7 100644 --- a/home/modules/ROOT/pages/download.adoc +++ b/home/modules/ROOT/pages/download.adoc @@ -1,190 +1,190 @@ -= Jetty Downloads - -The latest releases of Eclipse Jetty are listed below. -You can find earlier releases by browsing https://repo1.maven.org/maven2/org/eclipse/jetty[Maven Central]. - -[%header,grid=rows] -|=== -|Release 2+|Assets |Links -ifdef::site-gen-antora[] - -include::partial$jetty-downloads.adoc[] -endif::[] -|=== - -NOTE: Release notes are in the [.path]_VERSION.txt_ file included with the distribution and on the https://github.com/jetty/jetty.project/releases[GitHub Releases] page for the Jetty project. - -Release notes are also made available on the jetty-announce@eclipse.org mailing list. - -== What Version Do I Use? - -Jetty 12 is currently the community-supported version of Jetty. This means that Jetty 12 is the actively developed and supported version of Jetty for the open-source community. Issues filed for Jetty 12 at the GitHub repository are actively triaged and we work to resolve and release fixes for these releases. - -While many people continue to use older versions of Jetty like 11/10/9 for a variety of reasons including requirements for specific Java versions, we recommend using Jetty 12. Professional support is available for releases marked as End of Community Support (EOCS) and we encourage you to check out the Professional Services offered. - -January 1st, 2024 marked the end of community support for the Jetty 10 and 11 releases. - -== Version History - -[cols=1;1;1;1;1;1;1;3,grid=rows] -|=== -|Version |Years |Home |Min{nbsp}JVM |Servlet |JSP |Status |Protocols - -|12 -|2023- -|Eclipse -|17 footnote:jpms[JPMS module support is optional.] -|3.1 4.0 5.0 6.0 -|2.3 3.0 3.1 -|*Stable* -|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI, *JakartaEE Namespace* footnote:jakarta[Due to Oracle's ownership of the "`Java`" trademark, usage of the javax.{asterisk} namespace has been restricted, and the jakarta.{asterisk} namespace was adopted by the Eclipse Foundation.], JavaEE Namespace footnote:javaee[Only for Java EE 8 (Servlet 4.0, JSP 2.3) support, using the javax.{asterisk} namespace.] - -|11 -|2020- -|Eclipse -|11 footnote:jpms[] -|5.0 -|3.0 -|*Stable https://github.com/jetty/jetty.project/issues/10485[(Notice)]* -|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI, *JakartaEE Namespace* footnote:jakarta[] - -|10 -|2020- -|Eclipse -|11 footnote:jpms[] -|4.0 -|2.3 -|*Stable https://github.com/jetty/jetty.project/issues/10485[(Notice)]* -|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI - -|9.4 -|2016- -|Eclipse -|1.8 -|3.1 -|2.3 -|Stable https://github.com/jetty/jetty.project/issues/7958[(Notice)] -|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI - -|9.3 -|2015-2020 -|Eclipse -|1.8 footnote:jdk9[JDK9 and newer is not supported if using MultiRelease JAR Files, or Bytecode / Annotation scanning.] -|3.1 -|2.3 -|Deprecated -|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI - -|9.2 -|2014-2018 -|Eclipse -|1.7 footnote:jdk9[] -|3.1 -|2.3 -|Deprecated -|HTTP/1.1 (RFC 2616), javax.websocket, SPDY v3 - -|9.1 -|2013-2014 -|Eclipse -|1.7 footnote:jdk9[] -|3.1 -|2.3 -|Deprecated -|HTTP/1.1 (RFC 2616) - -|9.0 -|2013-2013 -|Eclipse -|1.7 footnote:jdk9[] -|3.1-beta -|2.3 -|Deprecated -|HTTP/1.1 (RFC 2616) - -|8 -|2009-2014 -|Eclipse / Codehaus -|1.6 footnote:jdk9[] -|3.0 -|2.2 -|Venerable -|HTTP/1.1 (RFC 2616), WebSocket RFC 6455, SPDY v3 - -|7 -|2008-2014 -|Eclipse / Codehaus -|1.5 -|2.5 -|2.1 -|Venerable -|HTTP/1.1 (RFC 2616), WebSocket RFC 6455, SPDY v3 - -|6 -|2006-2010 -|Codehaus -|1.4-1.5 -|2.5 -|2.0 -|Antique -|HTTP/1.1 (RFC 2616) - -|5 -|2003-2009 -|Sourceforge -|1.2-1.5 -|2.4 -|2.0 -|Relic -|HTTP/1.1 (RFC 2616) - -|4 -|2001-2006 -|Sourceforge -|1.2, J2ME -|2.3 -|1.2 -|Ancient -|HTTP/1.1 (RFC 2616) - -|3 -|1999-2002 -|Sourceforge -|1.2 -|2.2 -|1.1 -|Fossilized -|HTTP/1.1 (RFC 2068) - -|2 -|1998-2000 -|Mortbay -|1.1 -|2.1 -|1.0 -|Legendary -|HTTP/1.0 (RFC 1945) - -|1 -|1995-1998 -|Mortbay -|1.0 -|- -|- -|Mythical -|HTTP/1.0 (RFC 1945) -|=== - -== Prior Versions - -//The most recent versions of prior Jetty releases, with their associated documentation, can be found here. - -The canonical repository for Jetty is Maven Central. -//All releases are always available there first, and this download page may lag a bit update-wise as post-release resources are put into place. -You can browse for all Jetty releases at https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution[here]. - -== Jetty P2 Provisioning - -This provisioning address is not for general use and is provided strictly for OSGI users. - -* Composite Jetty 9 P2 Provisioning: http://download.eclipse.org/jetty/updates/jetty-bundles-9.x += Jetty Downloads + +The latest releases of Eclipse Jetty are listed below. +You can find earlier releases by browsing https://repo1.maven.org/maven2/org/eclipse/jetty[Maven Central]. + +[%header,grid=rows] +|=== +|Release 2+|Assets |Links +ifdef::site-gen-antora[] + +include::partial$jetty-downloads.adoc[] +endif::[] +|=== + +NOTE: Release notes are in the [.path]_VERSION.txt_ file included with the distribution and on the https://github.com/jetty/jetty.project/releases[GitHub Releases] page for the Jetty project. + +Release notes are also made available on the jetty-announce@eclipse.org mailing list. + +== What Version Do I Use? + +Jetty 12 is currently the community-supported version of Jetty. This means that Jetty 12 is the actively developed and supported version of Jetty for the open-source community. Issues filed for Jetty 12 at the GitHub repository are actively triaged and we work to resolve and release fixes for these releases. + +While many people continue to use older versions of Jetty like 11/10/9 for a variety of reasons including requirements for specific Java versions, we recommend using Jetty 12. Professional support is available for releases marked as End of Community Support (EOCS) and we encourage you to check out the Professional Services offered. + +January 1st, 2024 marked the end of community support for the Jetty 10 and 11 releases. + +== Version History + +[cols=1;1;1;1;1;1;1;3,grid=rows] +|=== +|Version |Years |Home |Min{nbsp}JVM |Servlet |JSP |Status |Protocols + +|12 +|2023- +|Eclipse +|17 footnote:jpms[JPMS module support is optional.] +|3.1 4.0 5.0 6.0 +|2.3 3.0 3.1 +|*Stable / Supported* +|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI, *JakartaEE Namespace* footnote:jakarta[Due to Oracle's ownership of the "`Java`" trademark, usage of the javax.{asterisk} namespace has been restricted, and the jakarta.{asterisk} namespace was adopted by the Eclipse Foundation.], JavaEE Namespace footnote:javaee[Only for Java EE 8 (Servlet 4.0, JSP 2.3) support, using the javax.{asterisk} namespace.] + +|11 +|2020- +|Eclipse +|11 footnote:jpms[] +|5.0 +|3.0 +|*EOL / Security Only https://github.com/jetty/jetty.project/issues/10485[(Notice)]* +|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI, *JakartaEE Namespace* footnote:jakarta[] + +|10 +|2020- +|Eclipse +|11 footnote:jpms[] +|4.0 +|2.3 +|*EOL / Security Only https://github.com/jetty/jetty.project/issues/10485[(Notice)]* +|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI + +|9.4 +|2016- +|Eclipse +|1.8 +|3.1 +|2.3 +|*EOL / Security Only https://github.com/jetty/jetty.project/issues/7958[(Notice)]* +|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI + +|9.3 +|2015-2020 +|Eclipse +|1.8 footnote:jdk9[JDK9 and newer is not supported if using MultiRelease JAR Files, or Bytecode / Annotation scanning.] +|3.1 +|2.3 +|Deprecated +|HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI + +|9.2 +|2014-2018 +|Eclipse +|1.7 footnote:jdk9[] +|3.1 +|2.3 +|Deprecated +|HTTP/1.1 (RFC 2616), javax.websocket, SPDY v3 + +|9.1 +|2013-2014 +|Eclipse +|1.7 footnote:jdk9[] +|3.1 +|2.3 +|Deprecated +|HTTP/1.1 (RFC 2616) + +|9.0 +|2013-2013 +|Eclipse +|1.7 footnote:jdk9[] +|3.1-beta +|2.3 +|Deprecated +|HTTP/1.1 (RFC 2616) + +|8 +|2009-2014 +|Eclipse / Codehaus +|1.6 footnote:jdk9[] +|3.0 +|2.2 +|Venerable +|HTTP/1.1 (RFC 2616), WebSocket RFC 6455, SPDY v3 + +|7 +|2008-2014 +|Eclipse / Codehaus +|1.5 +|2.5 +|2.1 +|Venerable +|HTTP/1.1 (RFC 2616), WebSocket RFC 6455, SPDY v3 + +|6 +|2006-2010 +|Codehaus +|1.4-1.5 +|2.5 +|2.0 +|Antique +|HTTP/1.1 (RFC 2616) + +|5 +|2003-2009 +|Sourceforge +|1.2-1.5 +|2.4 +|2.0 +|Relic +|HTTP/1.1 (RFC 2616) + +|4 +|2001-2006 +|Sourceforge +|1.2, J2ME +|2.3 +|1.2 +|Ancient +|HTTP/1.1 (RFC 2616) + +|3 +|1999-2002 +|Sourceforge +|1.2 +|2.2 +|1.1 +|Fossilized +|HTTP/1.1 (RFC 2068) + +|2 +|1998-2000 +|Mortbay +|1.1 +|2.1 +|1.0 +|Legendary +|HTTP/1.0 (RFC 1945) + +|1 +|1995-1998 +|Mortbay +|1.0 +|- +|- +|Mythical +|HTTP/1.0 (RFC 1945) +|=== + +== Prior Versions + +//The most recent versions of prior Jetty releases, with their associated documentation, can be found here. + +The canonical repository for Jetty is Maven Central. +//All releases are always available there first, and this download page may lag a bit update-wise as post-release resources are put into place. +You can browse for all Jetty releases at https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution[here]. + +== Jetty P2 Provisioning + +This provisioning address is not for general use and is provided strictly for OSGI users. + +* Composite Jetty 9 P2 Provisioning: http://download.eclipse.org/jetty/updates/jetty-bundles-9.x diff --git a/home/modules/ROOT/pages/index.adoc b/home/modules/ROOT/pages/index.adoc index 00cd5bb..72de170 100644 --- a/home/modules/ROOT/pages/index.adoc +++ b/home/modules/ROOT/pages/index.adoc @@ -1,51 +1,51 @@ -= The Eclipse Jetty Project -:noindex: - -image::jetty-logo.svg[alt=Jetty Logo,width=50%] - -Eclipse Jetty provides a highly scalable and memory-efficient web server and servlet container, supporting many protocols such as HTTP/3,2,1 and WebSocket. Furthermore, the project offers integrations with many other technologies, such as OSGi, JMX, JNDI, JAAS, etc. These components are open source and are freely available for commercial use and distribution under both the EPL2 and Apache2 licenses. - -== Blog Entries - -.Jetty Blogs -feed::https://webtide.com/blog/feed/[id=jetty-feed,max=6] - -The Eclipse Jetty project, a powerhouse in the open-source web server and servlet container realm boasts a robust codebase and a wealth of knowledge readily available through its official blogs. These blogs serve as a vibrant hub for developers of all levels, offering insights, technical deep-dives, and practical guidance on navigating the world of Jetty. - - -== Where is Jetty used? -Jetty has been used in various projects and products in development and production for over 20 years. Developers have long loved Jetty due to its history of being easily embedded in devices, tools, frameworks, application servers, and modern cloud services. Jetty serves the primary applications for billion-dollar companies, lurks in many cloud services, and has been involved in missions to Mars and on devices floating in the oceans of Earth. We are continuously astounded at the places where Jetty has appeared. - -Many documentation resources are available, including an operations guide and a programmer's guide, all accessible from the link:docs/[Documentation] page. - - -== About Jetty -=== Where has Jetty called home? -The Jetty project has found its home in many places over the last 20+ years. - -==== Eclipse and Github -In 2009, the Jetty project moved its core components to be a project of the Eclipse Foundation to improve the IP processes and broaden the licensing and community of the project. Beginning with Jetty 9, the project was moved to the Eclipse Foundation. Additionally, in 2016, the project moved the canonical source and issue repository to Github. - -==== Codehaus -In 2005, the jetty project moved to The Codehaus for its hosting services and open-source community. In 2009, after the core components of Jetty moved to Eclipse, the Jetty @ codehaus project continued to provide integrations, extensions, and packaging of Jetty. - -==== Sourceforge -From 2000 to 2005, the Jetty project was hosted at sourceforge.net, where versions 3.x, 4.x and 5.x were produced. - -=== Who has funded the development of Jetty? -The development of the Jetty project has been fully funded over the years through close collaboration with many wonderful clients. Professional Support has been organized through the entities mentioned below over the years. - -==== Webtide -In 2015, the development of Jetty was once more taken over by Webtide when the developers split away from Intalio, taking full ownership of the company behind the open-source project. Webtide is now 100% developer-owned and operated and fully funds the ongoing development of the Jetty project through services and support for the open-source releases of the Jetty project. - -==== Intalio -The role of the development of Jetty was taken over in 2009 by Intalio, Inc., who acquired both Webtide and Mort Bay. Intalio was a company that offered both products and services based on open-source software. They employed many jetty developers and contributors in addition to other open-source and closed-source platforms. - -==== Webtide -The role of leading the development of Jetty was taken over in 2006 by Webtide LLC, formed as a joint venture between Mort Bay and partners providing marketing, sales, and strategic assistance to the open-source project. - -==== Mort Bay -The Java HTTP server that became Jetty was initially developed in 1995 by Greg Wilkins of Mort Bay Consulting as part of an issue-tracking application. Versions 1.x through to 6.1.x of Jetty were developed under org.mortbay packaging and Mort Bay still hold the central part of the copyright on the Jetty code base. Mort Bay directly hosted the jetty project until version 3.x and was the prime sponsor of development until 6.x. - - - += The Eclipse Jetty Project +:noindex: + +image::jetty-logo.svg[alt=Jetty Logo,width=50%] + +Eclipse Jetty provides a highly scalable and memory-efficient web server and servlet container, supporting many protocols such as HTTP/3,2,1 and WebSocket. Furthermore, the project offers integrations with many other technologies, such as OSGi, JMX, JNDI, JAAS, etc. These components are open source and are freely available for commercial use and distribution under both the EPL2 and Apache2 licenses. + +== Blog Entries + +.Jetty Blogs +feed::https://webtide.com/blog/feed/[id=jetty-feed,max=6] + +The Eclipse Jetty project, a powerhouse in the open-source web server and servlet container realm boasts a robust codebase and a wealth of knowledge readily available through its official blogs. These blogs serve as a vibrant hub for developers of all levels, offering insights, technical deep-dives, and practical guidance on navigating the world of Jetty. + + +== Where is Jetty used? +Jetty has been used in various projects and products in development and production for over 20 years. Developers have long loved Jetty due to its history of being easily embedded in devices, tools, frameworks, application servers, and modern cloud services. Jetty serves the primary applications for billion-dollar companies, lurks in many cloud services, and has been involved in missions to Mars and on devices floating in the oceans of Earth. We are continuously astounded at the places where Jetty has appeared. + +Many documentation resources are available, including an operations guide and a programmer's guide, all accessible from the link:docs/[Documentation] page. + + +== About Jetty +=== Where has Jetty called home? +The Jetty project has found its home in many places over the last 20+ years. + +==== Eclipse and Github +In 2009, the Jetty project moved its core components to be a project of the Eclipse Foundation to improve the IP processes and broaden the licensing and community of the project. Beginning with Jetty 9, the project was moved to the Eclipse Foundation. Additionally, in 2016, the project moved the canonical source and issue repository to Github. + +==== Codehaus +In 2005, the jetty project moved to The Codehaus for its hosting services and open-source community. In 2009, after the core components of Jetty moved to Eclipse, the Jetty @ codehaus project continued to provide integrations, extensions, and packaging of Jetty. + +==== Sourceforge +From 2000 to 2005, the Jetty project was hosted at sourceforge.net, where versions 3.x, 4.x and 5.x were produced. + +=== Who has funded the development of Jetty? +The development of the Jetty project has been fully funded over the years through close collaboration with many wonderful clients. Professional Support has been organized through the entities mentioned below over the years. + +==== Webtide +In 2015, the development of Jetty was once more taken over by Webtide when the developers split away from Intalio, taking full ownership of the company behind the open-source project. Webtide is now 100% developer-owned and operated and fully funds the ongoing development of the Jetty project through services and support for the open-source releases of the Jetty project. + +==== Intalio +The role of the development of Jetty was taken over in 2009 by Intalio, Inc., who acquired both Webtide and Mort Bay. Intalio was a company that offered both products and services based on open-source software. They employed many jetty developers and contributors in addition to other open-source and closed-source platforms. + +==== Webtide +The role of leading the development of Jetty was taken over in 2006 by Webtide LLC, formed as a joint venture between Mort Bay and partners providing marketing, sales, and strategic assistance to the open-source project. + +==== Mort Bay +The Java HTTP server that became Jetty was initially developed in 1995 by Greg Wilkins of Mort Bay Consulting as part of an issue-tracking application. Versions 1.x through to 6.1.x of Jetty were developed under org.mortbay packaging and Mort Bay still hold the central part of the copyright on the Jetty code base. Mort Bay directly hosted the jetty project until version 3.x and was the prime sponsor of development until 6.x. + + + diff --git a/lib/jetty-downloads-extension.js b/lib/jetty-downloads-extension.js index e038dac..833fd38 100644 --- a/lib/jetty-downloads-extension.js +++ b/lib/jetty-downloads-extension.js @@ -1,72 +1,72 @@ -'use strict' - -const MAVEN_REPO_URL = 'https://repo1.maven.org/maven2' -const JAVADOC_ROOT_URL = 'https://javadoc.jetty.org' -const REPOSITORY = 'jetty/jetty.project' -const GROUP_ID = 'org.eclipse.jetty' -const ARTIFACT_ID = 'jetty-home' - -module.exports.register = function ({ config }) { - const { firstMajorVersion = 9, lastEolVersion, lastMajorVersion } = config - this.once('contentClassified', async ({ contentCatalog }) => { - const { Octokit } = this.require('@octokit/rest') - const octokit = new Octokit() - const [owner, repo] = REPOSITORY.split('/') - const releases = await collectLatestReleases({ octokit, owner, repo, firstMajorVersion, lastMajorVersion }) - const majorVersions = Object.keys(releases).sort((a, b) => b.localeCompare(a, 'en', { numeric: true })).map(Number) - const rows = [] - for (const majorVersion of majorVersions) { - const release = releases[majorVersion] - const cells = [] - cells.push(lastEolVersion && majorVersion <= lastEolVersion ? `${release.version} (EOCS)` : release.version) - cells.push(`${release.zip}[.zip${release.zipHash ? ',title=' + release.zipHash + ' (sha1)' : ''}]`) - cells.push(`${release.tgz}[.tgz${release.tgzHash ? ',title=' + release.tgzHash + ' (sha1)' : ''}]`) - cells.push(`${release.url}[Release Notes] / ${release.api}[API Docs]`) - rows.push(cells.map((it) => '|' + it).join(' ')) - } - const partial = contentCatalog.resolveResource('ROOT::partial$jetty-downloads.adoc') - partial.contents = Buffer.from(rows.map((it) => '\n\n' + it).join('')) - }) -} - -function collectLatestReleases ({ octokit, owner, repo, firstMajorVersion, lastMajorVersion, page = 1, accum = {} }) { - return octokit.repos.listReleases({ owner, repo, page, per_page: 50 }).then(async (result) => { - for (const release of result.data) { - if (release.draft || release.prerelease) continue - const version = release.name - const majorVersion = Number(version.split('.')[0]) - if (majorVersion in accum || majorVersion < firstMajorVersion) continue - const groupId = GROUP_ID - const artifactId = majorVersion < 10 ? 'jetty-distribution' : ARTIFACT_ID - const distBaseUrl = `${MAVEN_REPO_URL}/${groupId.replace(/[.]/g, '/')}/${artifactId}/${version}/${artifactId}-${version}` - const tgz = `${distBaseUrl}.tar.gz` - const tgzHash = await fetch(`${tgz}.sha1`).then((response) => response.text(), () => undefined) - if (!tgzHash) continue // not yet available in the Maven repo - const zip = `${distBaseUrl}.zip` - const zipHash = await fetch(`${zip}.sha1`).then((response) => response.text(), () => undefined) - if (!zipHash) continue // not yet available in the Maven repo - accum[majorVersion] = { - version: release.name, - date: release.created_at, - tgz, - tgzHash, - zip, - zipHash, - url: release.html_url, - api: `${JAVADOC_ROOT_URL}/jetty-${majorVersion}/index.html`, - } - } - if (lastMajorVersion && createRange(firstMajorVersion, lastMajorVersion).every((it) => it in accum)) return accum - const links = result.headers.link - if (links && links.includes('; rel="next"')) { - return collectLatestReleases({ octokit, owner, repo, firstMajorVersion, lastMajorVersion, page: page + 1, accum }) - } - return accum - }) -} - -function createRange (from, to) { - const result = [] - for (let i = from; i <= to; i++) result.push(i) - return result -} +'use strict' + +const MAVEN_REPO_URL = 'https://repo1.maven.org/maven2' +const JAVADOC_ROOT_URL = 'https://javadoc.jetty.org' +const REPOSITORY = 'jetty/jetty.project' +const GROUP_ID = 'org.eclipse.jetty' +const ARTIFACT_ID = 'jetty-home' + +module.exports.register = function ({ config }) { + const { firstMajorVersion = 9, lastEolVersion, lastMajorVersion } = config + this.once('contentClassified', async ({ contentCatalog }) => { + const { Octokit } = this.require('@octokit/rest') + const octokit = new Octokit() + const [owner, repo] = REPOSITORY.split('/') + const releases = await collectLatestReleases({ octokit, owner, repo, firstMajorVersion, lastMajorVersion }) + const majorVersions = Object.keys(releases).sort((a, b) => b.localeCompare(a, 'en', { numeric: true })).map(Number) + const rows = [] + for (const majorVersion of majorVersions) { + const release = releases[majorVersion] + const cells = [] + cells.push(lastEolVersion && majorVersion <= lastEolVersion ? `${release.version} (EOCS)` : release.version) + cells.push(`${release.zip}[.zip${release.zipHash ? ',title=' + release.zipHash + ' (sha1)' : ''}]`) + cells.push(`${release.tgz}[.tgz${release.tgzHash ? ',title=' + release.tgzHash + ' (sha1)' : ''}]`) + cells.push(`${release.url}[Release Notes] / ${release.api}[API Docs]`) + rows.push(cells.map((it) => '|' + it).join(' ')) + } + const partial = contentCatalog.resolveResource('ROOT::partial$jetty-downloads.adoc') + partial.contents = Buffer.from(rows.map((it) => '\n\n' + it).join('')) + }) +} + +function collectLatestReleases ({ octokit, owner, repo, firstMajorVersion, lastMajorVersion, page = 1, accum = {} }) { + return octokit.repos.listReleases({ owner, repo, page, per_page: 50 }).then(async (result) => { + for (const release of result.data) { + if (release.draft || release.prerelease) continue + const version = release.name + const majorVersion = Number(version.split('.')[0]) + if (majorVersion in accum || majorVersion < firstMajorVersion) continue + const groupId = GROUP_ID + const artifactId = majorVersion < 10 ? 'jetty-distribution' : ARTIFACT_ID + const distBaseUrl = `${MAVEN_REPO_URL}/${groupId.replace(/[.]/g, '/')}/${artifactId}/${version}/${artifactId}-${version}` + const tgz = `${distBaseUrl}.tar.gz` + const tgzHash = await fetch(`${tgz}.sha1`).then((response) => response.text(), () => undefined) + if (!tgzHash) continue // not yet available in the Maven repo + const zip = `${distBaseUrl}.zip` + const zipHash = await fetch(`${zip}.sha1`).then((response) => response.text(), () => undefined) + if (!zipHash) continue // not yet available in the Maven repo + accum[majorVersion] = { + version: release.name, + date: release.created_at, + tgz, + tgzHash, + zip, + zipHash, + url: release.html_url, + api: `${JAVADOC_ROOT_URL}/jetty-${majorVersion}/index.html`, + } + } + if (lastMajorVersion && createRange(firstMajorVersion, lastMajorVersion).every((it) => it in accum)) return accum + const links = result.headers.link + if (links && links.includes('; rel="next"')) { + return collectLatestReleases({ octokit, owner, repo, firstMajorVersion, lastMajorVersion, page: page + 1, accum }) + } + return accum + }) +} + +function createRange (from, to) { + const result = [] + for (let i = from; i <= to; i++) result.push(i) + return result +} diff --git a/ui/src/partials/feeds.hbs b/ui/src/partials/feeds.hbs index e53ae3e..58d9c39 100644 --- a/ui/src/partials/feeds.hbs +++ b/ui/src/partials/feeds.hbs @@ -1,4 +1,3 @@ -