Skip to content

Commit

Permalink
Merge pull request #36 from joewiz/bugfix/older-versions-html
Browse files Browse the repository at this point in the history
Hotfixes to prevent timeout, fix bugs; prepare v0.7.2
  • Loading branch information
wolfgangmm authored Feb 23, 2019
2 parents 13c3fad + 635196b commit f932ab6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
#

project.name=public-repo
project.version=0.7.1
project.version=0.7.2
27 changes: 15 additions & 12 deletions modules/app.xql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare function app:list-packages($node as node(), $model as map(*), $mode as x
let $show-details := false()
order by lower-case($app/title)
return
app:package-to-list-item($app, $show-details)
app:package-to-list-item($app, $app/version, $show-details)
};

declare function app:view-package($node as node(), $model as map(*), $mode as xs:string?) {
Expand Down Expand Up @@ -47,10 +47,11 @@ declare function app:view-package($node as node(), $model as map(*), $mode as xs
let $app-versions := ($app, $app/other/version)
let $compatible-xar := app:find-version($app-versions, $procVersion, (), (), (), ())
let $package := $app-versions[@path eq $compatible-xar]
let $version := ($package/@version, $package/version)[1]
let $show-details := true()
return
if (exists($package)) then
app:package-to-list-item($package, $show-details)
if (exists($app)) then
app:package-to-list-item($app, $version, $show-details)
else
(
response:set-status-code(404),
Expand All @@ -61,7 +62,7 @@ declare function app:view-package($node as node(), $model as map(*), $mode as xs
)
};

declare function app:package-to-list-item($app as element(app), $show-details as xs:boolean) {
declare function app:package-to-list-item($app as element(app), $version as xs:string, $show-details as xs:boolean) {
let $repoURL := concat(substring-before(request:get-uri(), "public-repo/"), "public-repo/")
let $icon :=
if ($app/icon) then
Expand All @@ -71,8 +72,10 @@ declare function app:package-to-list-item($app as element(app), $show-details as
$repoURL || "public/" || $app/icon[1]
else
$repoURL || "resources/images/package.png"
let $download-url := concat($repoURL, "public/", $app/@path)
let $required-exist-version := $app/requires[@processor eq "http://exist-db.org"]/(@version, @semver-min)[1]
let $path := ($app//version[@version eq $version]/@path, $app/@path)[1]
let $requires := ($app//version[@version eq $version]/requires, $app/requires)[1]
let $download-url := concat($repoURL, "public/", $path)
let $required-exist-version := $requires[@processor eq "http://exist-db.org"]/(@version, @semver-min)[1]
let $info-url :=
concat($repoURL, "packages/", $app/abbrev[not(@type eq "legacy")], ".html",
if ($required-exist-version) then
Expand Down Expand Up @@ -105,7 +108,7 @@ declare function app:package-to-list-item($app as element(app), $show-details as
</tr>
<tr>
<th>Version:</th>
<td>{ $app/version/text() }</td>
<td>{ $version }</td>
</tr>
<tr>
<td>Size:</td>
Expand All @@ -115,7 +118,7 @@ declare function app:package-to-list-item($app as element(app), $show-details as
if ($app/requires) then
<tr>
<td class="requires">Requirement:</td>
<td>eXist-db { if ($app/requires) then app:requires-to-english($app/requires) else () }</td>
<td>eXist-db { if ($requires) then app:requires-to-english($requires) else () }</td>
</tr>
else
()
Expand Down Expand Up @@ -147,7 +150,7 @@ declare function app:package-to-list-item($app as element(app), $show-details as
}
<tr>
<td>Download:</td>
<td><a href="{$download-url}" title="click to download package">{$app/@path/string()}</a></td>
<td><a href="{$download-url}" title="click to download package">{$path/string()}</a></td>
</tr>
{
if ($app/other/version) then
Expand Down Expand Up @@ -194,9 +197,9 @@ declare function app:package-to-list-item($app as element(app), $show-details as
<p>
{$app/description/text()}
<br/>
Version {$app/version/text()} {
if ($app/requires) then
concat(" (Requires eXist-db ", app:requires-to-english($app/requires), ".)")
Version {$version/string()} {
if ($requires) then
concat(" (Requires eXist-db ", app:requires-to-english($requires), ".)")
else
()
}
Expand Down
2 changes: 1 addition & 1 deletion modules/view.xql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import module namespace app="http://exist-db.org/xquery/app" at "app.xql";

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare option exist:timeout "40000";
declare option exist:timeout "300000";

declare option output:method "html5";
declare option output:media-type "text/html";
Expand Down
6 changes: 6 additions & 0 deletions repo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
<finish>post-install.xql</finish>
<permissions xmlns:repo="http://exist-db.org/xquery/repo" password="repo" user="repo" group="repo" mode="rw-rw-r--"/>
<changelog>
<change version="0.7.2">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li>Fixed: Display of HTML pages when requesting packages compatible with older versions of eXist.</li>
<li>Fixed: Increase timeout to 5 minutes when publishing apps to allow for re-scanning of larger repositories.</li>
</ul>
</change>
<change version="0.7.1">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li>Fixed: Issue preventing users from accessing older versions of packages when the newest release depends on a newer version of eXist.</li>
Expand Down

0 comments on commit f932ab6

Please sign in to comment.