rahiel / archiveror

Archiveror will help you preserve the webpages you love. 💾
https://www.rahielkasim.com/archiveror/
GNU General Public License v3.0
400 stars 43 forks source link

mhtml parsing #35

Closed benjamingr closed 5 years ago

benjamingr commented 5 years ago

Hey, I just published a fast mhtml parser that converts the mhtml files saved by Chrome to html and allows serving them.

Would love feedback and to know if it's relevant to you https://www.npmjs.com/package/fast-mhtml

rahiel commented 5 years ago

Cool, but we don't need converting of MHTML files.

sterbalr commented 5 years ago

I really wish you included this functionality in the extension.

rahiel commented 5 years ago

@sterbalr I don't see why this should be a part of archiveror, my extension archives pages to MHTML that can already be opened by Chromium, what would this add?

sterbalr commented 5 years ago

I am trying to use archiveror to make static copies of my wikis that I can use with Dropbox on iOS. Renaming the files is a challenging extra step since I have to do that on the OS.

rahiel commented 5 years ago

Why do you need to rename the archives? Can't you find a MHTML reader/viewer for iOS instead?

sterbalr commented 5 years ago

Dropbox provides a private place for me on the web and they don't seem to want to implement a mhtml viewer.

rahiel commented 5 years ago

Either way, this functionality is outside the scope of this extension.

sterbalr commented 5 years ago

I'm not sure I need anything other than a change of the name of the file extension from mhtml to html.

How many lines of code would need to be changed?

benjamingr commented 5 years ago

@sterbalr you can use fast-mhtml to do this, since it's very new I'd love it if more people get involved :)

rahiel commented 5 years ago

I'm not sure I need anything other than a change of the name of the file extension from mhtml to html.

How many lines of code would need to be changed?

I don't like including an extra dependency, but this change is possible. I've added a note to https://github.com/rahiel/archiveror/issues/26 to include choosing the file extension as an option.

benjamingr commented 5 years ago

@rahiel if you want a sticky release or to go through the code together you're welcome to use fast-mhtml any way you'd like. You're also (happily) welcome to "steal" the relevant files (with attribution)

rahiel commented 5 years ago

The issue for @sterbalr is purely with the file extension, not with the content. So it really is not necessary to integrate fast-mhtml into archiveror.

benjamingr commented 5 years ago

@rahiel ah, then it makes no sense - it's just a rename

sterbalr commented 5 years ago

Is this the line I would have to change?

function l(e){var t=e;for(t=e.replace(/[<>:"\/\|?*~]/g,"").trim();t.startsWith(".");)t=t.slice(1);return t}function u(e,t){return l(e)+""+(r=new Date,n=r.getUTCFullYear(),o=(r.getUTCMonth()+1).toString().padStart(2,"0"),a=r.getUTCDate().toString().padStart(2,"0"),i=r.getUTCHours().toString().padStart(2,"0"),c=r.getUTCMinutes().toString().padStart(2,"0"),${n}-${o}-${a}_${i}-${c})+"_"+t+".mhtml";

(in options.js)