openzim / zip2zim

[ARCHIVED] Convert Zip Files to Zim Files
https://zip2zim.openzim.org/
6 stars 2 forks source link

Document config.json #20

Open mattzab opened 5 years ago

mattzab commented 5 years ago

Zip2Zim requires config.json, but this is undocumented.

The webpage makes it appear as if config.json is optional for customization, but conversion will fail if this file is missing- even with index.html in the root.

As an example of a non-working json file I attempted to use within my zip file, see here.

No documentation can be found for what exactly is expected, and it is not clear that this file is required.

Solution: Add documentation to zip2zim.openzim.org webpage with examples, as well as possibly adding it to the readme.md file on this github project.

ISNIT0 commented 5 years ago

Odd, the "Really Boring Demo" example zip seems to work which only has an index.html file: http://zip2zim.openzim.org/#upload

kelson42 commented 5 years ago

@ISNIT0 Do you need something from @mattzab our me. Might that be that the JSON is OK, but somehow the relation to the content of the ZIP is wrong?

julianharty commented 5 years ago

@ISNIT0 When I tested the website 4 times using examples from the site, 2 of the uploads resulted in a zim being generated and 2 did not. From memory (I wasn't keeping notes) I tried the following:

  1. simple.zip - failed: no file generated
  2. simple.zip - worked: zim file generated
  3. testing_heuristics.zip - worked: zim file generated
  4. sunset.zip - failed: no file generated
  5. [sunset.zip]() - worked zim file generated

I've tried several more times, using the upload option from the homepage which worked and from the samples page (see above).

As you say, none of these files have a config.json so there may be another reason why sometimes the process fails...

Nonetheless providing examples that do include config.json may well help people to create more informative ZIM files :)

julianharty commented 5 years ago

I forgot to mention that when I uploaded a large ZIP file (around 893MB) the process failed and I saw an express message that the failure might be caused by a missing config.json

Here's the error page: https://zip2zim.openzim.org/fail.html#examples

Whoops!

Looks like we failed to generate your Zim file! Usually this is caused by a broken config.json file. If you're stuck, please open a GitHub issue.

Screenshot 2019-07-17 at 13 51 58
julianharty commented 5 years ago

@ISNIT0 I've spotted something that seems odd in the code build/index.js (presumably generated by npm start with the source of https://github.com/openzim/zip2zim/blob/master/index.ts where the catch codeblock copies favicon.png when config.json is not available. Perhaps, at least part of the confusion is related to this code? I'd expect it to copy a default config.json from ./res/ (assuming one existed there). Or have I misunderstood what this code is intended to do?

        try {
            var overrideConfig = JSON.parse(fs.readFileSync("./pool/" + id + "/content/config.json", 'utf8') || '{}');
            Object.assign(config, overrideConfig);
        }
        catch (e) {
            copyFileSync('./res/favicon.png', "./pool/" + id + "/content/favicon.png");
        }
julianharty commented 5 years ago

Possibly caused by an unrelated problem generating the zim? see #22 for an example of a problem, albeit one that resulted in another message...

ISNIT0 commented 5 years ago

Yes, see this: https://github.com/openzim/zip2zim/issues/24

julianharty commented 5 years ago

As part of the rewrite, how about the code logs/reports the configuration settings it used so users can see/check which settings were incorporated into the ZIM file?