Added better logging and browser support.
We still need to work on the Linux browser a bit.
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -2,10 +2,13 @@
|
|||||||
/.idea/
|
/.idea/
|
||||||
/build/
|
/build/
|
||||||
/*/build/
|
/*/build/
|
||||||
|
/*.log
|
||||||
|
/*/bin/
|
||||||
/local.properties
|
/local.properties
|
||||||
/browser/profile/extensions/universal_music@regis.edu.xpi
|
/browser/profile/extensions/universal_music@regis.edu.xpi
|
||||||
/browser/profile/cache2/*
|
/browser/profile/cache2/*
|
||||||
/browser/profile/datareporting/*
|
/browser/profile/datareporting/*
|
||||||
/browser/profile/startupCache/*
|
/browser/profile/startupCache/*
|
||||||
/browser/profile/sessionstore-backups/*
|
/browser/profile/sessionstore-backups/*
|
||||||
/browser/profile/lock
|
/browser/profile/lock
|
||||||
|
/browser/profile/
|
||||||
|
|||||||
11
addonInter/addonInter.iml
Normal file
11
addonInter/addonInter.iml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
135
addonInter/build.gradle
Normal file
135
addonInter/build.gradle
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import java.nio.file.CopyOption
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
|
import java.nio.file.Paths
|
||||||
|
import java.nio.file.StandardCopyOption
|
||||||
|
import java.util.stream.Stream
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'application'
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this section you declare where to find the dependencies of your project
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this section you declare the dependencies for your production and test code
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.slf4j:slf4j-api:1.7.30'
|
||||||
|
implementation 'org.apache.logging.log4j:log4j-api:2.13.3'
|
||||||
|
implementation 'org.apache.logging.log4j:log4j-core:2.13.3'
|
||||||
|
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'
|
||||||
|
|
||||||
|
// Declare the dependency for your favourite test framework you want to use in your tests.
|
||||||
|
// TestNG is also supported by the Gradle Test task. Just change the
|
||||||
|
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
|
||||||
|
// 'test.useTestNG()' to your build script.
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class BuildManifest extends DefaultTask {
|
||||||
|
@InputDirectory
|
||||||
|
final abstract DirectoryProperty inputFile = project.objects.directoryProperty()
|
||||||
|
@OutputFile
|
||||||
|
final abstract RegularFileProperty outputFile = project.objects.fileProperty().convention(project.layout.buildDirectory.file("manifest.json"))
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
void join() {
|
||||||
|
File startupScript
|
||||||
|
Stream<File> files = Arrays.stream(inputFile.get().asFile.listFiles())
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
startupScript = files.filter(file -> file.getName().endsWith(".bat")).findFirst().get()
|
||||||
|
}
|
||||||
|
else if (Os.isFamily(Os.FAMILY_UNIX)) {
|
||||||
|
startupScript = files.filter(file -> !file.getName().endsWith(".bat")).findFirst().get()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new RuntimeException("Unknown OS family")
|
||||||
|
}
|
||||||
|
outputFile.get().asFile.text = "{\n" +
|
||||||
|
" \"name\": \"universalmusic\",\n" +
|
||||||
|
" \"description\": \"A link between the Universal Music Player and the web browser.\",\n" +
|
||||||
|
" \"path\": \"" + startupScript.getAbsolutePath() + "\",\n" +
|
||||||
|
" \"type\": \"stdio\",\n" +
|
||||||
|
" \"allowed_extensions\": [\"universalmusic@regis.edu\"]\n" +
|
||||||
|
"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskProvider<BuildManifest> buildManifestP = tasks.register("buildManifest", BuildManifest) {
|
||||||
|
inputFile = tasks.named("startScripts", org.gradle.jvm.application.tasks.CreateStartScripts).get().outputDir
|
||||||
|
}
|
||||||
|
|
||||||
|
buildManifest.dependsOn(startScripts)
|
||||||
|
|
||||||
|
abstract class InstallAddon extends DefaultTask {
|
||||||
|
@InputFile
|
||||||
|
final abstract RegularFileProperty inputFile = project.objects.fileProperty()
|
||||||
|
@Internal
|
||||||
|
final abstract DirectoryProperty build = project.layout.buildDirectory
|
||||||
|
@InputDirectory
|
||||||
|
final abstract DirectoryProperty libsDir = project.objects.directoryProperty()
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
void join() {
|
||||||
|
Path lib = libsDir.get().asFile.toPath()
|
||||||
|
Path link = new File(build.get().asFile, "lib").toPath()
|
||||||
|
try {
|
||||||
|
// This takes up more space than I would like, but Windows doesn't allow symbolic links without superuser privliges
|
||||||
|
Files.walk(lib).forEach(file -> {
|
||||||
|
Path fileName = lib.relativize(file)
|
||||||
|
Path dest = link.resolve(fileName)
|
||||||
|
println fileName.toString() + ": " + file.toString() + " to " + dest.toString()
|
||||||
|
if (!Files.exists(dest)) {
|
||||||
|
try {
|
||||||
|
Files.copy(file, dest)
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Could not link " + file.toString() + " to " + dest.toString(), e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Could not link " + lib.toString() + " to " + link.toString(), e)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
Runtime.getRuntime()
|
||||||
|
.exec("REG ADD HKEY_CURRENT_USER\\SOFTWARE\\Mozilla\\NativeMessagingHosts /v universalmusic /d \""
|
||||||
|
+ inputFile.get().asFile.getAbsolutePath() + "\" ")
|
||||||
|
}
|
||||||
|
else if (Os.isFamily(Os.FAMILY_MAC)) {
|
||||||
|
Files.copy(inputFile.get().asFile.toPath(), Paths.get(System.getProperty("user.home"), "Library/Application Support/Mozilla/NativeMessagingHosts", inputFile.get().asFile.getName()))
|
||||||
|
}
|
||||||
|
else if (Os.isFamily(Os.FAMILY_UNIX)) {
|
||||||
|
Files.copy(inputFile.get().asFile.toPath(), Paths.get(System.getProperty("user.home"), ".mozilla/native-messaging-hosts", inputFile.get().asFile.getName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskProvider<InstallAddon> installAddonP = tasks.register("installAddon", InstallAddon) {
|
||||||
|
inputFile = buildManifestP.get().outputFile
|
||||||
|
libsDir = jar.destinationDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
installAddon.dependsOn(buildManifest)
|
||||||
|
|
||||||
|
run.dependsOn(installAddon)
|
||||||
|
|
||||||
|
// Define the main class for the application
|
||||||
|
mainClassName = defaultPackage + '.addon.Main'
|
||||||
|
|
||||||
|
compileJava.dependsOn rootProject.bundleAddOn
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package edu.regis.universeplayer.addon;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class Main
|
||||||
|
{
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(Main.class);
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
boolean running = true;
|
||||||
|
logger.info("This is an INFO level log message!");
|
||||||
|
logger.error("This is an ERROR level log message!");
|
||||||
|
logger.warn("This could be problimatic");
|
||||||
|
logger.info("https://sematext.com/blog/log4j2-tutorial/#toc-log4j-2-configuration-1");
|
||||||
|
while (running)
|
||||||
|
{
|
||||||
|
logger.info("Waiting1");
|
||||||
|
logger.debug("Waiting");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(500);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
logger.trace("Something interrupted us", e);
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
addonInter/src/main/resources/log4j2.xml
Normal file
21
addonInter/src/main/resources/log4j2.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2021 William Hubbard. All Rights Reserved.
|
||||||
|
-->
|
||||||
|
<Configuration status="WARN">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="%d%c%L %-5level - %msg%n"/>
|
||||||
|
</Console>
|
||||||
|
<File name="File" fileName="addonInter.log" append="false">
|
||||||
|
<PatternLayout>
|
||||||
|
<Pattern>%d{HH:mm:ss.SSS} - %45c:%-4L - %-5level - %msg%n</Pattern>
|
||||||
|
</PatternLayout>
|
||||||
|
</File>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="debug">
|
||||||
|
<AppenderRef ref="File"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"quit-application": 0, "profile-change-net-teardown": 0, "profile-change-teardown": 0, "profile-before-change": 0, "profile-before-change-qm": 0, "xpcom-will-shutdown": 1, "xpcom-shutdown": 0}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
aus5.mozilla.org:HSTS 0 18820 1657603618166,1,0,2
|
|
||||||
location.services.mozilla.com:HSTS 0 18820 1657602560679,1,1,2
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
301
|
|
||||||
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{"schema":6,"addons":[]}
|
|
||||||
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{"version":1,"listeners":{"remote-settings/monitor_changes":{"version":"\"1626055040565\"","sourceInfo":{"moduleURI":"resource://services-settings/remote-settings.js","symbolName":"remoteSettingsBroadcastHandler"}}}}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
# PSM Certificate Override Settings file
|
|
||||||
# This is a generated file! Do not edit.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[Compatibility]
|
|
||||||
LastVersion=90.0_20210624190035/20210624190035
|
|
||||||
LastOSABI=Linux_x86_64-gcc3
|
|
||||||
LastPlatformDir=/home/markil3/Projects/UniversalMusicPlayer/browser/linux64
|
|
||||||
LastAppDir=/home/markil3/Projects/UniversalMusicPlayer/browser/linux64/browser
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"version":4,"lastUserContextId":5,"identities":[{"userContextId":1,"public":true,"icon":"fingerprint","color":"blue","l10nID":"userContextPersonal.label","accessKey":"userContextPersonal.accesskey","telemetryId":1},{"userContextId":2,"public":true,"icon":"briefcase","color":"orange","l10nID":"userContextWork.label","accessKey":"userContextWork.accesskey","telemetryId":2},{"userContextId":3,"public":true,"icon":"dollar","color":"green","l10nID":"userContextBanking.label","accessKey":"userContextBanking.accesskey","telemetryId":3},{"userContextId":4,"public":true,"icon":"cart","color":"pink","l10nID":"userContextShopping.label","accessKey":"userContextShopping.accesskey","telemetryId":4},{"userContextId":5,"public":false,"icon":"","color":"","name":"userContextIdInternal.thumbnail","accessKey":""},{"userContextId":4294967295,"public":false,"icon":"","color":"","name":"userContextIdInternal.webextStorageLocal","accessKey":""}]}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user