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

Remove contributors file from NVDA, read license as HTML #17600

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
6 changes: 4 additions & 2 deletions contributors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
This is a list of people and organizations that contributed to the NVDA project in various ways since the beginning of the project. For an overview of code contributors, see also
https://github.com/nvaccess/nvda/graphs/contributors
This is a list of people and organizations that contributed to the NVDA project in various ways since the beginning of the project.
This list was archived in January 2025, and is no longer being maintained.
For an overview of code contributors, see also https://github.com/nvaccess/nvda/graphs/contributors.
For a list of active contributors, see the experts list https://github.com/nvaccess/nvda/blob/master/projectDocs/community/expertsList.md

NV Access Limited
Michael Curran
Expand Down
48 changes: 29 additions & 19 deletions copying.txt
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
NVDA is available under the GNU General Public License version 2, with two special exceptions.
The exceptions are outlined in the sections "Non-GPL Components in Plugins and Drivers" and "Microsoft Distributable Code".
NVDA also includes and uses components which are made available under different free and open source licenses.
Information about how to obtain and build the code for yourself is available at http://community.nvda-project.org/wiki/AccessingAndRunningSourceCode
Information about how to obtain and build the code for yourself is available at <https://github.com/nvaccess/nvda/blob/master/projectDocs/dev/contributing.md>.
All applicable licenses are included below.

## GNU GENERAL PUBLIC LICENSE
seanbudd marked this conversation as resolved.
Show resolved Hide resolved

https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html/>

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
<https://fsf.org/>
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
<https://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

### Preamble

Expand Down Expand Up @@ -306,31 +305,42 @@ DAMAGES.

Plugins and drivers, including those provided by third parties, are considered derivative works of NVDA and must therefore be licensed under the terms of the GNU General Public License version 2.
As a special exception, an NVDA plugin or driver (as defined in the NVDA Developer Guide) may use components under other licenses provided that:
a) Any such component does not prevent the NVDA plugin or driver from being licensed under the terms of the GNU General Public License version 2; and
b) Any such component does not directly use and is not directly used by any portion of NVDA outside of that plugin or driver.

a. Any such component does not prevent the NVDA plugin or driver from being licensed under the terms of the GNU General Public License version 2; and

b. Any such component does not directly use and is not directly used by any portion of NVDA outside of that plugin or driver.
For example, a speech synthesizer driver may use a speech synthesiser under a proprietary license.
In contrast, in a plugin providing support for an application, the code which implements any interface provided by NVDA must be licensed under the GNU General Public License version 2.


## Microsoft Distributable Code

This applies to the following files:
- mfc*.dll
- Microsoft.VC*.manifest
- msvc*.dll

* `mfc*.dll`
* `Microsoft.VC*.manifest`
* `msvc*.dll`

As a special exception to the GNU General Public License version 2, these components may be included with binary distributions of NVDA without being subject to the terms of that license.

Microsoft Distributable Code is covered by the following terms:

You may not
a) alter any copyright, trademark or patent notice in the Distributable Code;
b) use Microsoft's trademarks in your programs' names or in a way that suggests your programs come from or are endorsed by Microsoft;
c) distribute Distributable Code to run on a platform other than the Windows platform;
d) include Distributable Code in malicious, deceptive or unlawful programs; or
e) modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that
i) the code be disclosed or distributed in source code form; or
ii) others have the right to modify it.

a. alter any copyright, trademark or patent notice in the Distributable Code;

b. use Microsoft's trademarks in your programs' names or in a way that suggests your programs come from or are endorsed by Microsoft;

c. distribute Distributable Code to run on a platform other than the Windows platform;

d. include Distributable Code in malicious, deceptive or unlawful programs; or

e. modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License.
An Excluded License is one that requires, as a condition of use, modification or distribution, that

i. the code be disclosed or distributed in source code form; or

ii. others have the right to modify it.

## Third-Party Dependencies

Expand All @@ -349,4 +359,4 @@ In addition to these dependencies, the following are also included in NVDA:

Furthermore, NVDA also utilises some static/binary dependencies, details of which can be found at the following URL:

https://github.com/nvaccess/nvda-misc-deps/tree/master
<https://github.com/nvaccess/nvda-misc-deps/>
34 changes: 29 additions & 5 deletions source/documentationUtils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2024 NV Access Limited, Łukasz Golonka
# Copyright (C) 2006-2025 NV Access Limited, Łukasz Golonka
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html

from typing import Optional
from functools import lru_cache
import os

import markdown
import nh3

import globalVars
from gui import blockAction
import languageHandler
import NVDAState
from logHandler import log
Expand All @@ -16,7 +20,7 @@
import wx


def getDocFilePath(fileName: str, localized: bool = True) -> Optional[str]:
def getDocFilePath(fileName: str, localized: bool = True) -> str | None:
if not getDocFilePath.rootPath:
if NVDAState.isRunningAsSource():
getDocFilePath.rootPath = os.path.join(globalVars.appDir, "..", "user_docs")
Expand Down Expand Up @@ -47,8 +51,8 @@ def getDocFilePath(fileName: str, localized: bool = True) -> Optional[str]:
return None
else:
# Not localized.
if NVDAState.isRunningAsSource() and fileName in ("copying.txt", "contributors.txt"):
# If running from source, these two files are in the root dir.
if NVDAState.isRunningAsSource() and fileName == "copying.txt":
# If running from source, this file is in the root dir.
return os.path.join(globalVars.appDir, "..", fileName)
else:
return os.path.join(getDocFilePath.rootPath, fileName)
Expand All @@ -75,3 +79,23 @@ def reportNoDocumentation(fileName: str, useMsgBox: bool = False) -> None:
)
else:
queueHandler.queueFunction(queueHandler.eventQueue, ui.message, noDocMessage)


@lru_cache(maxsize=1)
def _getSanitizedHtmlLicense() -> str:
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
licenseFilename: str = getDocFilePath("copying.txt", False)
with open(licenseFilename, "r", encoding="utf-8") as licenseFile:
htmlLicense = markdown.markdown(licenseFile.read())
return nh3.clean(htmlLicense)
seanbudd marked this conversation as resolved.
Show resolved Hide resolved


@blockAction.when(blockAction.Context.SECURE_MODE)
def displayLicense():
# HTML includes links which shouldn't be accessible
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand this comment, it's however not clear from the comment how activating links is avoided here. I assume that links are not rendered in browseable messages?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's avoided by the blocking the whole action with the blockAction. Links are rendered in the browseable messages. I'm not sure if I can place the comment any closer to the decorator while keeping formatting happy. Maybe

@blockAction.when(
	# HTML includes links which shouldn't be accessible
	blockAction.Context.SECURE_MODE
)
def displayLicense():

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I see now, thanks for clarifying.
Can't we instruct nh3 to strip links in a secure context, for example by providing an empty list of url schemes?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but I think it's useful for these links to work, no?

Copy link
Collaborator

@LeonarddeR LeonarddeR Jan 15, 2025

Choose a reason for hiding this comment

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

It definitely is 😉
However, we can make the behavior of nh3 differ from the default behavior when in a secure context, for example:

if secureContext:
	attribute_filter = lambda tag, attr, val: None if tag.lower() == "a" and attr.lower() == "href" else val
else:
	attribute_filter = None

In secure context, we probably also want to pass something like url_schemes=set() to ensure that external comments will never load.
The latter might even be enough, as long as we don't provide something like <a href="something">something</a> as these won't be filtered.

Copy link
Member Author

Choose a reason for hiding this comment

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

@SaschaCowley - do you think this is necessary?

Copy link
Member

Choose a reason for hiding this comment

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

Potentially useful, but not necessary. Note this would also require changes to browsable message, which is currently not available when running on a secure desktop.

nvda/source/ui.py

Lines 156 to 158 in fa619c2

if isRunningOnSecureDesktop():
_warnBrowsableMessageNotAvailableOnSecureScreens(title)
return

Copy link
Member

Choose a reason for hiding this comment

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

I think your first suggestion (putting the explanatory comment in the decorator) is the way to go here, @seanbudd

# in secure contexts as it opens a browser.
ui.browseableMessage(
_getSanitizedHtmlLicense(),
# Translators: The title of the dialog to show the NVDA License.
_("NVDA License"),
isHtml=True,
)
21 changes: 4 additions & 17 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Copyright (C) 2006-2025 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt, Cyrille Bougot, Luke Davis
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
Expand All @@ -15,7 +15,7 @@
import globalVars
import tones
import ui
from documentationUtils import getDocFilePath, reportNoDocumentation
from documentationUtils import getDocFilePath, displayLicense, reportNoDocumentation
from logHandler import log
import config
import versionInfo
Expand Down Expand Up @@ -804,22 +804,9 @@ def _appendHelpSubMenu(self, frame: MainFrame) -> None:

self.helpMenu.AppendSeparator()

# Translators: The label for the menu item to view NVDA License document.
# Translators: The label for the menu item to view the NVDA License.
item = self.helpMenu.Append(wx.ID_ANY, _("L&icense"))
self.Bind(
wx.EVT_MENU,
lambda evt: systemUtils._displayTextFileWorkaround(getDocFilePath("copying.txt", False)),
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
item,
)
# Translators: The label for the menu item to view NVDA Contributors list document.
item = self.helpMenu.Append(wx.ID_ANY, _("C&ontributors"))
self.Bind(
wx.EVT_MENU,
lambda evt: systemUtils._displayTextFileWorkaround(getDocFilePath("contributors.txt", False)),
item,
)

self.helpMenu.AppendSeparator()
self.Bind(wx.EVT_MENU, lambda evt: displayLicense(), item)

# Translators: The label for the menu item to open NVDA Welcome Dialog.
item = self.helpMenu.Append(wx.ID_ANY, _("We&lcome dialog..."))
Expand Down
54 changes: 25 additions & 29 deletions source/gui/startupDialogs.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2023 NV Access Limited, Łukasz Golonka, Cyrille Bougot
# Copyright (C) 2006-2025 NV Access Limited, Łukasz Golonka, Cyrille Bougot
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html

from typing import Set
import weakref
import wx
import wx.html2

import config
from config.configFlags import NVDAKey
import core
from documentationUtils import getDocFilePath
from documentationUtils import _getSanitizedHtmlLicense
import globalVars
import gui
from gui.dpiScalingHelper import DpiScalingHelperMixinWithoutInit
import gui.guiHelper
import keyboardHandler
from logHandler import log
import versionInfo
Expand Down Expand Up @@ -173,7 +175,7 @@ class LauncherDialog(

helpId = "InstallingNVDA"

def __init__(self, parent):
def __init__(self, parent: wx.Window | None):
super().__init__(
parent,
title=f"{versionInfo.name} {_('Launcher')}",
Expand All @@ -184,12 +186,6 @@ def __init__(self, parent):

sHelper.addItem(self._createLicenseAgreementGroup())

# Translators: The label for a checkbox in NvDA installation program to agree to the license agreement.
agreeText = _("I &agree")
self.licenseAgreeCheckbox = sHelper.addItem(wx.CheckBox(self, label=agreeText))
self.licenseAgreeCheckbox.Value = False
self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree)

sizer = sHelper.addItem(wx.GridSizer(2, 2, 0, 0))
self.actionButtons = []
# Translators: The label of the button in NVDA installation program to install NvDA on the user's computer.
Expand Down Expand Up @@ -221,28 +217,28 @@ def __init__(self, parent):
mainSizer.Fit(self)
self.CentreOnScreen()

def _createLicenseAgreementGroup(self) -> wx.StaticBoxSizer:
def _createLicenseAgreementGroup(self) -> wx.BoxSizer:
sizer = wx.BoxSizer(wx.VERTICAL)

# Translators: The label of the license text which will be shown when NVDA installation program starts.
groupLabel = _("License Agreement")
sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel)
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
# Create a fake text control to determine appropriate width of license text box
_fakeTextCtrl = wx.StaticText(
self,
label="a" * 80, # The GPL2 text of copying.txt wraps sentences at 80 characters
)
widthOfLicenseText = _fakeTextCtrl.Size[0]
_fakeTextCtrl.Destroy()
licenseTextCtrl = wx.TextCtrl(
self,
size=(widthOfLicenseText, self.scaleSize(300)),
style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH,
)
licenseTextCtrl.Value = open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read()
sizer.Add(
licenseTextCtrl,
flag=wx.EXPAND,
proportion=1,
)
groupText = wx.StaticText(self, label=groupLabel)
sizer.Add(groupText, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL)

# Arbitrary size which fills the dialog and is readable.
# Note that a webview doesn't expand with wx.EXPAND and being added to the sizer,
# a minimum size is needed to make it readable.
licenseView: wx.html2.WebView = wx.html2.WebView.New(self, size=self.scaleSize((550, 400)))
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
sizer.Add(licenseView, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL)
licenseView.SetPage(_getSanitizedHtmlLicense(), "")

# Translators: The label for a checkbox in NVDA installation process to agree to the license agreement.
agreeText = _("I have read and &agree to the license agreement")
self.licenseAgreeCheckbox = wx.CheckBox(self, label=agreeText)
self.licenseAgreeCheckbox.SetValue(False)
self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree)
sizer.Add(self.licenseAgreeCheckbox, border=gui.guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL)

return sizer

def onLicenseAgree(self, evt):
Expand Down
6 changes: 4 additions & 2 deletions source/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Joseph Lee
# Copyright (C) 2006-2025 NV Access Limited, Peter Vágner, Joseph Lee
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

Expand Down Expand Up @@ -239,6 +239,8 @@ def _genManifestTemplate(shouldHaveUIAccess: bool) -> tuple[int, int, bytes]:
"brailleDisplayDrivers.dotPad",
"synthDrivers",
"visionEnhancementProviders",
# Required for markdown, markdown implicitly imports this so it isn't picked up
"html.parser",
],
"includes": [
"nvdaBuiltin",
Expand All @@ -250,7 +252,7 @@ def _genManifestTemplate(shouldHaveUIAccess: bool) -> tuple[int, int, bytes]:
},
data_files=[
(".", glob("*.dll") + glob("*.manifest") + ["builtin.dic"]),
("documentation", ["../copying.txt", "../contributors.txt"]),
("documentation", ["../copying.txt"]),
("lib/%s" % version, glob("lib/*.dll") + glob("lib/*.manifest")),
("lib64/%s" % version, glob("lib64/*.dll") + glob("lib64/*.exe")),
("libArm64/%s" % version, glob("libArm64/*.dll") + glob("libArm64/*.exe")),
Expand Down
12 changes: 1 addition & 11 deletions source/systemUtils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2020-2023 NV Access Limited, Łukasz Golonka, Luke Davis
# Copyright (C) 2020-2025 NV Access Limited, Łukasz Golonka, Luke Davis
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -35,7 +35,6 @@
import winUser
import functools
import shlobj
from os import startfile
from logHandler import log
from NVDAState import WritePaths

Expand Down Expand Up @@ -188,15 +187,6 @@ def _getDesktopName() -> str:
return name.value


def _displayTextFileWorkaround(file: str) -> None:
# os.startfile does not currently (NVDA 2023.1, Python 3.7) work reliably to open .txt files in Notepad under
# Windows 11, if relying on the default behavior (i.e. `operation="open"`). (#14725)
# Using `operation="edit"`, however, has the desired effect--opening the text file in Notepad. (#14816)
# Since this may be a bug in Python 3.7's os.startfile, or the underlying Win32 function, it may be
# possible to deprecate this workaround after a Python upgrade.
startfile(file, operation="edit")


def _isSystemClockSecondsVisible() -> bool:
"""
Query the value of 'ShowSecondsInSystemClock' DWORD32 value in the Windows registry under
Expand Down
2 changes: 2 additions & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ To use this feature, "allow NVDA to control the volume of other applications" mu
* Updated CLDR to version 46.0. (#17484, @OzancanKaratas)
* Short versions of the most commonly used command line options have been added: `-d` for `--disable-addons` and `-n` for `--lang`.
Prefix matching on command line flags, e.g. using `--di` for `--disable-addons` is no longer supported. (#11644, @CyrilleB79)
* The "Contributors" file has been removed from the NVDA menu. (#16922)
* The NVDA license is now formatted in HTML to improve readability. (#17600)
* Microsoft Speech API version 5 and Microsoft Speech Platform voices now use WASAPI for audio output, which may improve the responsiveness of those voices. (#13284, @gexgd0419)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions user_docs/en/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ The year and version changes between updates to reflect the current release.
You may need to wait a few seconds while a temporary copy of NVDA loads.
Once loaded, NVDA will speak throughout the rest of the process.
1. The NVDA Launcher window appears with the license agreement.
Press `downArrow` to read the license agreement if desired.
Press the `downArrow` to read the license agreement.
1. Press `tab` to move to the "I agree" checkbox, then press the `spacebar` to check it.
1. Press `tab` to move through the options, then press `enter` on the desired option.

Expand Down Expand Up @@ -5202,7 +5202,7 @@ Secure mode disables:
* The [NVDA Python console](#PythonConsole)
* The [Log Viewer](#LogViewer) and logging
* The [Braille Viewer](#BrailleViewer) and [Speech Viewer](#SpeechViewer)
* Opening external documents from the NVDA menu, such as the user guide or contributors file.
* Opening external documents from the NVDA menu, such as the user guide file.

Installed copies of NVDA store their configuration including add-ons in `%APPDATA%\nvda`.
To prevent NVDA users from modifying their configuration or add-ons directly, user access to this folder must also be restricted.
Expand Down