Skip to content

Commit

Permalink
bridge: Rename the manifest.js .json URLs to 'manifests'
Browse files Browse the repository at this point in the history
This is a better name indicating it is the result of merging all
the manifests on that server.

Add documentation.
  • Loading branch information
stefwalter committed Feb 25, 2015
1 parent 8086635 commit 30733b1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
9 changes: 9 additions & 0 deletions doc/urls.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ and their characteristics:

* ```/cockpit/@host/package/path/to/file.ext``` are files from packages (on
specific hosts) that are not cached. Only available after authentication.

* ```/cockpit/@host/checksum``` returns the checksum of the host packages
or an empty string if none

* ```/cockpit/@host/manifests.json``` includes a summary of all the manifest
files from all the packages

* ```/cockpit/@host/manifests.js``` includes a summary of all the manifest
files from all the packages, as an AMD loadable module
4 changes: 2 additions & 2 deletions pkg/base/cockpit.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,9 @@ function package_table(host, callback) {
}
var url;
if (!host)
url = "../manifest.json";
url = "../manifests.json";
else
url = "../../@" + host + "/manifest.json";
url = "../../@" + host + "/manifests.json";
var req = new window.XMLHttpRequest();
req.open("GET", url);
req.onreadystatechange = function() {
Expand Down
28 changes: 14 additions & 14 deletions src/bridge/cockpitpackages.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,11 @@ add_cache_header (GHashTable *headers,
}

static gboolean
handle_package_manifest_js (CockpitWebServer *server,
const gchar *path,
GHashTable *headers,
CockpitWebResponse *response,
CockpitPackages *packages)
handle_package_manifests_js (CockpitWebServer *server,
const gchar *path,
GHashTable *headers,
CockpitWebResponse *response,
CockpitPackages *packages)
{
GHashTable *out_headers;
GBytes *content;
Expand All @@ -657,11 +657,11 @@ handle_package_manifest_js (CockpitWebServer *server,
}

static gboolean
handle_package_manifest_json (CockpitWebServer *server,
const gchar *path,
GHashTable *headers,
CockpitWebResponse *response,
CockpitPackages *packages)
handle_package_manifests_json (CockpitWebServer *server,
const gchar *path,
GHashTable *headers,
CockpitWebResponse *response,
CockpitPackages *packages)
{
GHashTable *out_headers;
GBytes *content;
Expand Down Expand Up @@ -942,10 +942,10 @@ cockpit_packages_new (void)

g_signal_connect (packages->web_server, "handle-resource::/checksum",
G_CALLBACK (handle_package_checksum), packages);
g_signal_connect (packages->web_server, "handle-resource::/manifest.js",
G_CALLBACK (handle_package_manifest_js), packages);
g_signal_connect (packages->web_server, "handle-resource::/manifest.json",
G_CALLBACK (handle_package_manifest_json), packages);
g_signal_connect (packages->web_server, "handle-resource::/manifests.js",
G_CALLBACK (handle_package_manifests_js), packages);
g_signal_connect (packages->web_server, "handle-resource::/manifests.json",
G_CALLBACK (handle_package_manifests_json), packages);
g_signal_connect (packages->web_server, "handle-resource",
G_CALLBACK (handle_packages), packages);

Expand Down
8 changes: 4 additions & 4 deletions src/bridge/test-packages.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ test_large (TestCase *tc,
}

static const Fixture fixture_listing = {
.path = "/manifest.json",
.path = "/manifests.json",
};

static void
Expand Down Expand Up @@ -417,19 +417,19 @@ test_bad_receive (TestCase *tc,
static const Fixture fixture_list_bad_directory = {
.datadirs = { SRCDIR "/src/bridge/mock-resource/bad-directory", NULL },
.expect = "package * invalid *name*",
.path = "/manifest.json"
.path = "/manifests.json"
};

static const Fixture fixture_list_bad_file = {
.datadirs = { SRCDIR "/src/bridge/mock-resource/bad-file", NULL },
.expect = "package * invalid *name*",
.path = "/manifest.json"
.path = "/manifests.json"
};

static const Fixture fixture_list_bad_name = {
.datadirs = { SRCDIR "/src/bridge/mock-resource/bad-package", NULL },
.expect = "package * invalid *name*",
.path = "/manifest.json"
.path = "/manifests.json"
};

static void
Expand Down

0 comments on commit 30733b1

Please sign in to comment.