Compare commits
	
		
			8 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 37c1482407 | ||
|  | 565eef7327 | ||
|  | 87e84dec5c | ||
|  | 4b782133ae | ||
|  | 423884ae0c | ||
|  | 7ea3d0aab1 | ||
|  | 18b15f5cf4 | ||
|  | 3540774c82 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,2 +1,3 @@ | ||||
| /build | ||||
| .vscode | ||||
| /submodules/arrpc | ||||
|   | ||||
| @@ -14,28 +14,29 @@ string(TIMESTAMP TIMESTAMP %s) | ||||
| # set(CMAKE_AUTOUIC ON) | ||||
|  | ||||
| find_package(Qt5 COMPONENTS Widgets) | ||||
| if (Qt5_FOUND) | ||||
| if (Qt5_FOUND AND NOT DEFINED USE_QT6) | ||||
|   message(STATUS "Using Qt 5") | ||||
|   find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets WebEngineWidgets) | ||||
|  | ||||
|   find_package(KF5Notifications) | ||||
|   if(KF5Notifications_FOUND) | ||||
|     add_definitions( -DKNOTIFICATIONS ) | ||||
|   endif() | ||||
|  | ||||
|   find_package(KF5XmlGui) | ||||
|   if(KF5XmlGui_FOUND) | ||||
|     add_definitions( -DKXMLGUI ) | ||||
|   endif() | ||||
|  | ||||
|   find_package(KF5GlobalAccel) | ||||
|   if(KF5GlobalAccel_FOUND) | ||||
|     add_definitions( -DKGLOBALACCEL ) | ||||
|   endif() | ||||
| else() | ||||
|   message(WARNING "Qt 5 was not found on your system and Qt 6 will be used. You will not be able to use any features using KDE Frameworks.") | ||||
|   message(STATUS "Using Qt 6") | ||||
|   find_package(Qt6 CONFIG REQUIRED COMPONENTS Widgets WebEngineWidgets) | ||||
| endif() | ||||
|  | ||||
| find_package(KF5Notifications) | ||||
| if(KF5Notifications_FOUND) | ||||
|   add_definitions( -DKNOTIFICATIONS ) | ||||
| endif() | ||||
|  | ||||
| find_package(KF5XmlGui) | ||||
| if(KF5XmlGui_FOUND) | ||||
|   add_definitions( -DKXMLGUI ) | ||||
| endif() | ||||
|  | ||||
| find_package(KF5GlobalAccel) | ||||
| if(KF5GlobalAccel_FOUND) | ||||
|   add_definitions( -DKGLOBALACCEL ) | ||||
| endif() | ||||
|  | ||||
| set(discord-screenaudio_SRC | ||||
|   src/main.cpp | ||||
|   src/mainwindow.cpp | ||||
|   | ||||
							
								
								
									
										5635
									
								
								assets/arrpc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5635
									
								
								assets/arrpc.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -2,7 +2,8 @@ | ||||
| <RCC> | ||||
|   <qresource> | ||||
|     <file>assets/userscript.js</file> | ||||
|     <file>assets/bridge_mod.js</file> | ||||
|     <file>assets/arrpc_bridge_mod.js</file> | ||||
|     <file>assets/arrpc.js</file> | ||||
|     <file>assets/de.shorsh.discord-screenaudio.png</file> | ||||
|   </qresource> | ||||
| </RCC> | ||||
							
								
								
									
										36
									
								
								scripts/build_arrpc.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								scripts/build_arrpc.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| #!/usr/bin/bash | ||||
| set -e | ||||
|  | ||||
| cd "$(dirname "$0")/../submodules" | ||||
|  | ||||
| echo_status() { | ||||
|   echo | ||||
|   echo | ||||
|   echo "-> $1..." | ||||
| } | ||||
|  | ||||
| if [ ! -d "arrpc" ]; then | ||||
|   echo_status "Cloning arRPC" | ||||
|   git clone https://github.com/OpenAsar/arrpc.git | ||||
|   cd arrpc | ||||
| else | ||||
|   echo_status "Fetching arRPC changes" | ||||
|   cd arrpc | ||||
|   git fetch | ||||
| fi | ||||
|  | ||||
| echo_status "Checking out latest commit" | ||||
| git reset --hard HEAD | ||||
| git checkout main | ||||
|  | ||||
| echo_status "Installing dependencies" | ||||
| pnpm i -D @vercel/ncc | ||||
|  | ||||
| echo_status "Patching arRPC" | ||||
| sed -i 's/"type": "module",//' package.json | ||||
|  | ||||
| echo_status "Building arRPC" | ||||
| pnpm exec ncc build src/index.js | ||||
|  | ||||
| echo_status "Copying built file" | ||||
| cp -v ./dist/index.js ../../assets/arrpc.js | ||||
| @@ -11,7 +11,6 @@ | ||||
| CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent) { | ||||
|   setStyleSheet("background-color:#313338;"); | ||||
|   m_layout = new QVBoxLayout(this); | ||||
|   m_layout->setMargin(0); | ||||
|   m_layout->setSpacing(0); | ||||
|   setupWebView(); | ||||
| } | ||||
|   | ||||
| @@ -9,6 +9,7 @@ | ||||
| #include <QFileInfo> | ||||
| #include <QMessageBox> | ||||
| #include <QNetworkReply> | ||||
| #include <QTemporaryFile> | ||||
| #include <QTimer> | ||||
| #include <QWebChannel> | ||||
| #include <QWebEngineScript> | ||||
| @@ -35,11 +36,9 @@ DiscordPage::DiscordPage(QWidget *parent) : QWebEnginePage(parent) { | ||||
|  | ||||
|   injectFile(&DiscordPage::injectScript, "userscript.js", | ||||
|              ":/assets/userscript.js"); | ||||
|               | ||||
|   injectFile(&DiscordPage::injectScript, "bridge_mod.js", | ||||
|              ":/assets/bridge_mod.js"); | ||||
|  | ||||
|   setupUserStyles(); | ||||
|   setupArrpc(); | ||||
| } | ||||
|  | ||||
| void DiscordPage::setupPermissions() { | ||||
| @@ -294,3 +293,19 @@ void DiscordPage::javaScriptConsoleMessage( | ||||
| } | ||||
|  | ||||
| UserScript *DiscordPage::userScript() { return &m_userScript; } | ||||
|  | ||||
| void DiscordPage::setupArrpc() { | ||||
|   QFile nodejs("/usr/bin/node"); | ||||
|   if (nodejs.exists()) { | ||||
|     auto arrpcSource = QTemporaryFile::createNativeFile(":/assets/arrpc.js"); | ||||
|     qDebug(mainLog).noquote() | ||||
|         << "NodeJS found, starting arRPC located at" << arrpcSource->fileName(); | ||||
|     m_arrpcProcess.setProcessChannelMode(QProcess::ForwardedChannels); | ||||
|     m_arrpcProcess.setProgram(nodejs.fileName()); | ||||
|     m_arrpcProcess.setArguments(QStringList{arrpcSource->fileName()}); | ||||
|     m_arrpcProcess.start(); | ||||
|  | ||||
|     injectFile(&DiscordPage::injectScript, "arrpc_bridge_mod.js", | ||||
|                ":/assets/arrpc_bridge_mod.js"); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -5,6 +5,7 @@ | ||||
| #include <QDir> | ||||
| #include <QFile> | ||||
| #include <QNetworkAccessManager> | ||||
| #include <QProcess> | ||||
| #include <QStandardPaths> | ||||
| #include <QWebEngineFullScreenRequest> | ||||
| #include <QWebEnginePage> | ||||
| @@ -22,10 +23,12 @@ private: | ||||
|   QFile *m_userStylesFile; | ||||
|   QString m_userStylesContent; | ||||
|   QNetworkAccessManager m_networkAccessManager; | ||||
|   QProcess m_arrpcProcess; | ||||
|   const QDir m_configLocation = | ||||
|       QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); | ||||
|   void setupPermissions(); | ||||
|   void setupUserStyles(); | ||||
|   void setupArrpc(); | ||||
|   void fetchUserStyles(); | ||||
|   bool acceptNavigationRequest(const QUrl &url, | ||||
|                                QWebEnginePage::NavigationType type, | ||||
|   | ||||
| @@ -99,7 +99,8 @@ void MainWindow::cleanTrayIcon() { | ||||
| } | ||||
|  | ||||
| void MainWindow::setupSettings() { | ||||
|   m_settings = new QSettings("maltejur", "discord-screenaudio", this); | ||||
|   m_settings = | ||||
|       new QSettings("discord-screenaudio", "discord-screenaudio", this); | ||||
|   m_settings->beginGroup("settings"); | ||||
|   m_settings->endGroup(); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user