Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LD_SINGLEFILE_OPTIONS #912

Closed
StephenMottershead opened this issue Nov 12, 2024 · 11 comments
Closed

LD_SINGLEFILE_OPTIONS #912

StephenMottershead opened this issue Nov 12, 2024 · 11 comments

Comments

@StephenMottershead
Copy link

Hello,

I am trying to use the "self-extracting-archive=ture" with LD_SINGLEFILE_OPTIONS but not sure how to do that inside of the .env file. Is this at all possible?

@jasonlearst
Copy link

HI @StephenMottershead,

You can add the line LD_SINGLEFILE_OPTIONS='--self-extracting-archive=true' to the .env. file. You will need to make sure that you have the env file option set to have all variables present in it passed to the container. If you are using docker compose it would be these lines from the example:

    env_file:
      - .env

References:
https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/#use-the-env_file-attribute

@StephenMottershead
Copy link
Author

Hello @jasonlearst

Thank you for your reply. Just try that now and still not working, just creates a normal HTML with embed image. This setting should make it so it creates an u.zip.html instead.

@jasonlearst
Copy link

Hi @StephenMottershead ,

I noticed that the value defaults to true according to the code.

I don't have any value set for LD_SINGLEFILE_OPTIONS and my instance stores .html.gz files.

@StephenMottershead
Copy link
Author

Hello @jasonlearst,

Yes, that is right. The HTML is zipped in a gz, the zip doesn't contain any of the files like images. It a normal HTML file with all the image compressed into it.

@jasonlearst
Copy link

@StephenMottershead , I see. As far as I can tell Linkding just integrates the single-file-cli application for archiving. I suggest looking around the documentation/help for that application to figure out what options need to be passed to store the images in the format you want.

Once you know the options you need you can pass them into the single-file application with the LD_SINGLEFILE_OPTIONS environment variable.

@StephenMottershead
Copy link
Author

StephenMottershead commented Nov 22, 2024

Hello,

After a little bit of playing about, I have sorted out the problem, and it wasn't obvious when you look at the file format. You need to put this code below in your .env file.

The HTML will still be in html.gz file, and you need to unzip to access the HTML file. You then need to change .html file to .zIp and then unzip it. This will let you access the files inside from the website including the images, etc.

compress-content="true"

@lilygthb
Copy link

lilygthb commented Dec 7, 2024

Hello,

After a little bit of playing about, I have sorted out the problem, and it wasn't obvious when you look at the file format. You need to put this code below in your .env file.

The HTML will still be in html.gz file, and you need to unzip to access the HTML file. You then need to change .html file to .zIp and then unzip it. This will let you access the files inside from the website including the images, etc.

compress-content="true"

I can't reproduce your behavior: After decompressing the .html.gz I get an .html but if I change the extension to .zip the decompression doesn't work. Archive utility on Mac says is in unsupported format.

Unsure if I was using the right syntax I played with the .env file, here are the different syntaxes with the results:

LD_SINGLEFILE_OPTIONS=--compress-content=true     -> creates snapshot but I can't unzip it
LD_SINGLEFILE_OPTIONS=--compress-content="True"   -> html snapshot failed
LD_SINGLEFILE_OPTIONS='--compress-content=True'   -> html snapshot failed
LD_SINGLEFILE_OPTIONS=--compress-content=True     -> html snapshot failed

Which is the correct syntax to specify single file options in the `.env. file?

@StephenMottershead
Copy link
Author

Hello,
After a little bit of playing about, I have sorted out the problem, and it wasn't obvious when you look at the file format. You need to put this code below in your .env file.
The HTML will still be in html.gz file, and you need to unzip to access the HTML file. You then need to change .html file to .zIp and then unzip it. This will let you access the files inside from the website including the images, etc.
compress-content="true"

I can't reproduce your behavior: After decompressing the .html.gz I get an .html but if I change the extension to .zip the decompression doesn't work. Archive utility on Mac says is in unsupported format.

Unsure if I was using the right syntax I played with the .env file, here are the different syntaxes with the results:

LD_SINGLEFILE_OPTIONS=--compress-content=true     -> creates snapshot but I can't unzip it
LD_SINGLEFILE_OPTIONS=--compress-content="True"   -> html snapshot failed
LD_SINGLEFILE_OPTIONS='--compress-content=True'   -> html snapshot failed
LD_SINGLEFILE_OPTIONS=--compress-content=True     -> html snapshot failed

Which is the correct syntax to specify single file options in the `.env. file?

It is the second one. LD_SINGLEFILE_OPTIONS=--compress-content="true" It could be the capital T?
I haven't tried doing it on a Mac cant see it being any different. I will give it a go in a bit.

@lilygthb
Copy link

lilygthb commented Dec 7, 2024

It is the second one. LD_SINGLEFILE_OPTIONS=--compress-content="true" It could be the capital T? I haven't tried doing it on a Mac cant see it being any different. I will give it a go in a bit.

I just tried
LD_SINGLEFILE_OPTIONS=--compress-content="true"

Linkding creates the snapshot but the final zip is unable to decompress

@StephenMottershead
Copy link
Author

It is the second one. LD_SINGLEFILE_OPTIONS=--compress-content="true" It could be the capital T? I haven't tried doing it on a Mac cant see it being any different. I will give it a go in a bit.

I just tried LD_SINGLEFILE_OPTIONS=--compress-content="true"

Linkding creates the snapshot but the final zip is unable to decompress

Okay. Just got my MacBook out and had a look. It is an apple thing. You need to use Unarchiver (app store)instead of the default one, sadly. If you like the terminal, the unzip command does seem to work. Very odd but working with that Unarchiver.

@lilygthb
Copy link

lilygthb commented Dec 8, 2024

Okay. Just got my MacBook out and had a look. It is an apple thing. You need to use Unarchiver (app store)instead of the default one, sadly. If you like the terminal, the unzip command does seem to work. Very odd but working with that Unarchiver.

Thank you so much, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants