Project

General

Profile

« Previous | Next » 

Revision 1c65dd5c

Added by koszko over 1 year ago

adapt to changes in file path format

From now on we assume Hydrilla serves file contents at 'file/sha256/' instead of 'file/sha256-'.
With this commit we also stop using the "hash_key" property internally.

View differences:

html/payload_create.js
45 45
#IMPORT common/indexeddb.js AS haketilodb
46 46

  
47 47
#FROM html/DOM_helpers.js IMPORT clone_template
48
#FROM common/sha256.js    IMPORT sha256
48
#FROM common/sha256.js    IMPORT sha256 AS compute_sha256
49 49
#FROM common/patterns.js  IMPORT validate_normalize_url_pattern, \
50 50
                                 patterns_doc_url
51 51

  
......
94 94
    const script = form_ctx.script.value;
95 95
    if (!script)
96 96
	throw "The 'script' field is required!";
97
    const hash_key = `sha256-${sha256(script)}`;
97
    const sha256 = compute_sha256(script);
98 98

  
99 99
    const resource = {
100 100
	source_name: identifier,
......
106 106
	version: [1],
107 107
	description,
108 108
	dependencies: [],
109
	scripts: [{file: "payload.js", hash_key}]
109
	scripts: [{file: "payload.js", sha256}]
110 110
    };
111 111

  
112 112
    const mapping = {
......
121 121
	payloads
122 122
    };
123 123

  
124
    return {identifier, resource, mapping, files: {[hash_key]: script}};
124
    return {identifier, resource, mapping, files_by_sha256: {[sha256]: script}};
125 125
}
126 126

  
127 127
function clear_form(form_ctx)
......
137 137
{
138 138
    const db = await haketilodb.get();
139 139
    const tx_starter = haketilodb.start_items_transaction;
140
    const tx_ctx = await tx_starter(["resource", "mapping"], saving.files);
140
    const files = {sha256: saving.files_by_sha256};
141
    const tx_ctx = await tx_starter(["resource", "mapping"], files);
141 142

  
142 143
    for (const type of ["resource", "mapping"]) {
143 144
	if (!saving[`override_${type}`] &&

Also available in: Unified diff