2 Commits 87bde39abd ... 5f5fc05be9

Author SHA1 Message Date
  nullifed 5f5fc05be9 Add license and README.md 2 years ago
  nullifed 057ac1dc8c Upload the code. 2 years ago

+ 124 - 0
LICENSEv2

@@ -0,0 +1,124 @@
+=======================================================================================
+= NOT FINAL PRODUCT: This license isn't a finalized product and is subject to change. =
+=======================================================================================
+POSS: Probably Open Source License, Version 2.0
+Includes: [CoC - Code of Conduct]
+    · "Common Sense CoC" 1.0
+    · "Common Sense CoC" 2.0
+
+What:
+    The POSS license takes an alternate approach on open-source, taking into
+    consideration the current political state and the state of the programming
+    industry and tries to focus on core values instead of utter bullshit.
+
+Why:
+    In the 21st century we have managed to devolve further than before and have
+    managed to put politics into everything, including the software we make.
+    Most new licenses (and Code of Conduct) seem to enforce how we eat and breathe
+    instead of focusing on basic etiquette and that some words clearly are X because
+    they said so.
+
+    If salad and egg emojis are somehow offensive, then clearly we don't deserve to be
+    this technologically advanced.
+
+Differences over other Licenses:
+    · Much less scary looking text.
+    · Addresses 2 annoying birds with a single stone.
+    · Does politics politically incorrectly and correctly.
+    · Includes the "Anti-Woke takeover" clause.
+    · Uses Common Sense.
+	Since you don't have that.
+
+The "Anti-Woke takeover" Clause:
+    · Do you have a project or codebase that went woke?
+    · Want to continue using it without the woke part and with your own fork?
+    Then this license allows you to dump the original License and Code of Conduct,
+    because you can, and replace it with the POSS License and (optionally) the Code
+    of Conduct.
+    Of course you can completely remove the Code of Conduct too.
+    Unhappy because of this? Too bad.
+
+The License:
+	The following table shows the state of the current program and will have rules below that apprehended to table.
+	The software developer must fill in this table before using this license.
+
+		Main rule table: (non-[] is mandatory and cannot be changed)
+		-------------------------------------------------
+		- BASE:					YES	-
+		-------------------------------------------------
+		- SOFTWARE_OS:				[YES/NO]-
+		-------------------------------------------------
+		- SOFTWARE_PAID:			[YES/NO]-
+		-------------------------------------------------
+		- SOFTWARE_3P_STUFF:			[YES/NO]-
+		-------------------------------------------------
+		- SOFTWARE_WARRANTY:			NO  	-
+		-------------------------------------------------
+
+		
+		Subset rule table:
+		-------------------------------------------------
+		- ENFORCE_TRUE_OSS:			[YES/NO]-
+		-------------------------------------------------
+		- ALLOW_PAID_FREE:			[YES/NO]-
+		-------------------------------------------------
+		- ALL_RIGHTS_RESERVED: 			[YES/NO]-
+		-------------------------------------------------
+
+	BASE: (a.k.a. Basic Rules that are always present)
+		The original owner and all contributors will always retain attribution rights, no matter what.
+		The original owner can also decide to keep all usage rights, even usage rights. (Check ALL_RIGHTS_RESERVED)
+		This license defaults to the CoC 2.0, if it decides to include this CoC and unless mentioned otherwise.
+	SOFTWARE_OS: (a.k.a.. Is the software open-source?)
+		The license has a strict term on making OSS (Open Source Software) into closed source software.
+		If the software is open-source and you wish to make it closed-source, then sorry to ruin your day, but this license prohibits that.
+			Although adding closed-source blobs is perfectly fine, as long it is disclosed that it includes them.
+			(!!!) Software marked with ENFORCE_TRUE_OSS: Requires all parts of it to be open, this includes blobs.
+		If the software is closed-source and you wish to make it open-source, then you can, although you cannot go back.
+			Of course, closed-source blobs are exempt from this.
+			(!!!) Software marked with ENFORCE_TRUE_OSS: Blobs must be made open-source too, or must not be included.
+		If the answer is no, then the license treats it as a "view/analysis/research/use" only, meaning no republishing can made.
+
+	SOFTWARE_PAID: (a.k.a.. Is the software commercialized?)
+		The license has strict enforcement on paid and free software definitions too.
+		(!!!) ENFORCE_TRUE_OSS: The software must be free as in beer, no-buts.
+		YES: (and the software IS NOT a fork)
+			Then go nuts.
+		YES: (and the software IS a fork)
+			Then it depends the on the fork, if it is paid already, then you are allowed.
+			However, if it is NOT paid, then you a forbidden from re-sale of what is already free.
+		NO:
+			Then it is free, even if forked or modified.
+			(!!!) However if it is a fork then check if ALLOW_PAID_FREE is allowed, because if it isn't then you must set SOFTWARE_PAID to "YES (ORIGINAL)"
+
+	SOFTWARE_3P_STUFF: (a.k.a. Does the software contain any third-party libraries/etc.?)
+		This license has laid back enforcement of attribution to third-party libraries.
+
+	SOFTWARE_WARRANTY: (a.k.a. Does the software have warranty?)
+		No. This license DOES NOT support any warranty.
+		It has so little warranty that here's some scary looking legal text to prove it.
+
+		THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+		EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+		MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+		IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+		OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+		ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+		OTHER DEALINGS IN THE SOFTWARE.
+	ALL_RIGHTS_RESERVED:
+		If YES: Then the owner retains all rights to the code.
+
+Common Sense Code of Conduct - Version 1.0:
+    The Common Sense Code of Conduct
+	- Don't be an asshole.
+	- Sometimes you need to be called out for your shit.
+	- Old terminology doesn't need to be replaced.
+	- Code != Politics
+	- No fun allowed :)
+
+Common Sense Code of Conduct - Version 2.0:
+    The Common Sense Code of Conduct
+	- You can be called out for code quality or other reasons.
+	- Old terminology does not need any replacement, because of feelings.
+	- Fun is fun, but is it allowed?
+	- You shouldn't be an asshole, however, sometimes it is justified.

+ 34 - 1
README.md

@@ -1,3 +1,36 @@
 # yawk-browser
 
-Yet another WebKit/Blink browser... (based upon Qt5)
+Yet another WebKit/Blink browser... (based upon Qt5)
+
+## About Project
+
+This project is **archived** until further notice and is the remains of an old project making small browser alike to surf.
+
+## Features
+
+- Supports both Blink and WebKit (QtWebEngine and QtWebKit)
+- Built-in adblocker
+- Support for private tabs
+- Basic settings
+
+## Unimplemented planned features
+
+- Support for the Gopher protocol (this was added but the code was lost)
+- Support for QtWebEngine flags (GPU zero-copy and hardware video decoding)
+- Support for DRM (this was added but the code was lost)
+- Plugin API
+
+## License
+
+This project is licensed under the POSS license, version 2.0.
+
+NOTE: The optional code of conduct is NOT present within this project.
+
+POSS terms:
+
+- SOFTWARE_OS: YES
+- SOFTWARE_PAID: NO
+- SOFTWARE_3P_STUFF: YES
+- SOFTWARE_WARRANTY: NO
+- ENFORCE_TRUE_OSS: YES
+- ALLOW_PAID_FREE: YES

+ 0 - 0
__init__.py


+ 41 - 0
engines/Engine.py

@@ -0,0 +1,41 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.QtWebEngineWidgets import *
+from PyQt5.QtPrintSupport import *
+
+import abc
+from abc import *
+
+class Engine(QWidget):
+    __metaclass__ = abc.ABCMeta
+    parent = None
+    index = -1
+
+    def __init__(self, parent):
+        super(QWidget, self).__init__(parent)
+        self.parent = parent
+        try:
+            self.index = parent.getIndex()
+        except Exception as e:
+            print(e)
+        self.layout = QVBoxLayout(self)
+        self.layout.setContentsMargins(0, 0, 0, 0)
+
+        self.toolbar = QToolBar()
+        self.toolbar.layout = QHBoxLayout(self)
+        self.toolbar.layout.setContentsMargins(0, 0, 0, 0)
+        self.toolbar.setStyleSheet("QToolBar {height: 26px; max-height: 26px; padding: 0px; margin: 0px;}")
+
+        self.layout.addWidget(self.toolbar)
+
+    @abstractmethod
+    def forward(self):
+        pass
+
+    @abstractmethod
+    def back(self):
+        pass
+
+    def __getIndex(self):
+        return self.index

+ 14 - 0
engines/EngineView.py

@@ -0,0 +1,14 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.QtWebEngineWidgets import *
+from PyQt5.QtPrintSupport import *
+
+class EngineAdapter(QWidget):
+    def __init__(self, parent, item):
+        super(QWidget, self).__init__(parent)
+        self.layout = QHBoxLayout(self)
+        self.layout.setContentsMargins(0, 0, 0, 0)
+        self.setContentsMargins(0, 0, 0, 0)
+
+        self.layout.addWidget(item)

+ 0 - 0
engines/__init__,py.py


+ 138 - 0
engines/webengine/YAWKWebEngine.py

@@ -0,0 +1,138 @@
+from engines.Engine import Engine
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.QtWebEngineWidgets import *
+from settings.settings import *
+from network.webengine.filteredwebenginepage import *
+from nativePlugins.NativePlugins import triggerLoadedEvent, triggerLoadStartEvent, createLoadEvent, triggerLoadProgressEvent
+
+class YawkEngineView(QWebEngineView):
+    parent = None
+    def __init__(self, parent):
+        super().__init__()
+        self.parent = parent
+        self.titleChanged.connect(self.adjustTitle)
+
+    def adjustTitle(self):
+        try:
+            self.parent.setTabText(self.parent.index, self.title())
+        except Exception as e:
+            print(e)
+
+BUTTON_CSS = "QPushButton {" \
+                "width: 32px;" \
+                "max-width: 32px;" \
+             "}"
+
+class YawkWebEngine(Engine):
+    curl = HOME_PAGE
+
+    def __init__(self, parent, mode="default"):
+        super().__init__(parent)
+
+        self.engine = YawkEngineView(self)
+        self.interceptor = FilteredInterceptor()
+        self.profile = QWebEngineProfile()
+        self.profile.setRequestInterceptor(self.interceptor)
+        if mode == "safe":
+            self.profile.setHttpCacheType(QWebEngineProfile.MemoryHttpCache)
+            self.profile.setHttpUserAgent("Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0")
+            self.profile.settings().setAttribute(QWebEngineSettings.WebRTCPublicInterfacesOnly, False)
+            self.profile.settings().setAttribute(QWebEngineSettings.DnsPrefetchEnabled, False)
+            self.profile.setPersistentCookiesPolicy(QWebEngineProfile.NoPersistentCookies)
+        elif mode == "safe_max" or mode == "tor":
+            self.profile.setHttpCacheType(QWebEngineProfile.NoCache)
+            self.profile.setHttpUserAgent("Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0")
+            self.profile.settings().setAttribute(QWebEngineSettings.WebRTCPublicInterfacesOnly, True)
+            self.profile.settings().setAttribute(QWebEngineSettings.DnsPrefetchEnabled, False)
+            self.profile.setPersistentCookiesPolicy(QWebEngineProfile.NoPersistentCookies)
+        else:
+            self.profile.setHttpCacheType(QWebEngineProfile.DiskHttpCache)
+            self.profile.setHttpUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36")
+            self.profile.settings().setAttribute(QWebEngineSettings.DnsPrefetchEnabled, getSettingAsBool("network.prefetching", False))
+            self.profile.settings().setAttribute(QWebEngineSettings.WebRTCPublicInterfacesOnly,
+                                                 getSettingAsBool("network.cullwebrtc", False))
+        self.page = FilteredPage(self.profile, self.engine)
+        self.page.loadFinished.connect(self.loaded)
+        self.page.loadStarted.connect(self.loadStart)
+        self.page.loadProgress.connect(self.loadProgress)
+        self.layout.addWidget(self.engine)
+        self.engine.setPage(self.page)
+        self.page.setUrl(QUrl(HOME_PAGE))
+
+        self.backButton = QPushButton()
+        self.backButton.setText("←")
+        self.backButton.setToolTip("Go back a page, if possible.")
+        self.backButton.setStyleSheet(BUTTON_CSS)
+        self.backButton.clicked.connect(self.back)
+        self.toolbar.addWidget(self.backButton)
+
+        self.forwardButton = QPushButton()
+        self.forwardButton.setText("→")
+        self.forwardButton.setToolTip("Go forward a page, if possible.")
+        self.forwardButton.setStyleSheet(BUTTON_CSS)
+        self.forwardButton.clicked.connect(self.forward)
+        self.toolbar.addWidget(self.forwardButton)
+
+        self.urlBar = QLineEdit()
+        self.urlBar.returnPressed.connect(self.openPageG)
+        self.urlBar.setText(self.page.url().toEncoded().data().decode('utf-8'))
+        self.page.urlChanged.connect(self.urlChanged)
+        self.toolbar.addWidget(self.urlBar)
+
+    def back(self):
+        self.engine.back()
+
+    def forward(self):
+        self.engine.forward()
+
+    def urlChanged(self, url):
+        self.urlBar.setText(url.toEncoded().data().decode('utf-8'))
+        self.curl = url.toEncoded().data().decode('utf-8')
+
+    def setTabText(self, index, text):
+        self.parent.setTabText(index, text)
+
+    def openPageG(self):
+        try:
+            self.openPage(self.urlBar.text())
+        except Exception as e:
+            print(e)
+
+    def openPage(self, url):
+        try:
+            self.page.setUrl(QUrl(url))
+            self.curl = url
+        except Exception as e:
+            print(e)
+
+    def loaded(self, ok=False):
+        if ok:
+            p0 = \
+                "(function () {" + \
+                "var node = document.createElement('style');" \
+                "node.innerHTML = " + "\"" + "html, head, body, p, h1, h2, h3, h4, h5, h6 {" \
+                                                "font-family: -apple-system, BlinkMacSystemFont, 'Product Sans', 'Google Sans', 'SF Pro Display', 'Segoe UI', 'Arial', sans-serif !important;" \
+                                             "}" + "\"" + ";" \
+                "document.body.appendChild(node);" \
+                "delete node;" \
+                "})();"
+            self.page.runJavaScript(p0);
+            triggerLoadedEvent(createLoadEvent(self.page, self.page.url().toEncoded().data().decode('utf-8')))
+        else:
+            pass
+            # ????
+
+    def loadStart(self):
+        if getSettingAsBool("network.disablewebrtc", False):
+            print("loadProgress -> Disabling WebRTC...")
+            TO_REMOVE = ["navigator.mediaDevices.getUserMedia", "navigator.webkitGetUserMedia", "navigator.mozGetUserMedia",
+                         "navigator.getUserMedia", "window.RTCPeerConnection", "window.MediaStreamTrack",
+                         "window.webkitRTCPeerConnection", "window.RTCPeerConnection"]
+            for toRemove in TO_REMOVE:
+                self.page.runJavaScript(toRemove + " = undefined; delete " + toRemove + ";")
+        triggerLoadStartEvent(createLoadEvent(self.page, self.curl))
+
+    def loadProgress(self, progress):
+        triggerLoadProgressEvent(createLoadEvent(self.page, self.curl), progress)

+ 0 - 0
engines/webengine/__init__.py


+ 0 - 0
engines/webkit/YAWKWebKit.py


+ 0 - 0
engines/webkit/__init__.py


Some files were not shown because too many files changed in this diff