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

feat: add license info to js, for LibreJS compatibility #2793

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

piperswe
Copy link
Contributor

LibreJS is a browser extension developed by GNU which ensures only Free (libre) JavaScript is run. To determine whether given JavaScript is Free, LibreJS consults metadata included in the JavaScript file. Since Miniflux is Free Software, getting its JavaScript to work when LibreJS is installed is just a matter of adding license metadata to the returned JavaScript source.

Do you follow the guidelines?

[LibreJS][0] is a browser extension developed by GNU which ensures only Free (libre) JavaScript is run. To determine whether given JavaScript is Free, LibreJS consults metadata included in the JavaScript file. Since Miniflux is Free Software, getting its JavaScript to work when LibreJS is installed is just a matter of adding license metadata to the returned JavaScript source.

[0]: https://www.gnu.org/software/librejs/index.html
Copy link
Member

@fguillot fguillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more appropriate to implement this feature in the minifier that run at startup time.

var prefixes = map[string]string{
"app": "(function(){'use strict';",
}
var suffixes = map[string]string{
"app": "})();",
}

@piperswe
Copy link
Contributor Author

It would be more appropriate to implement this feature in the minifier that run at startup time.

I would agree, but showJavascript injects OFFLINE_URL before the minified JavaScript so it wouldn't be under the license header (and therefore would be stripped by LibreJS).

if filename == "service-worker" {
variables := fmt.Sprintf(`const OFFLINE_URL=%q;`, route.Path(h.router, "offline"))
contents = append([]byte(variables), contents...)
}

@fguillot
Copy link
Member

I would agree, but showJavascript injects OFFLINE_URL before the minified JavaScript so it wouldn't be under the license header (and therefore would be stripped by LibreJS).

Good catch

@fguillot fguillot merged commit ee926e7 into miniflux:main Aug 13, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants