From 07ced7b4ee51abdcf700b1181ea34624d99eab78 Mon Sep 17 00:00:00 2001 From: Julia Nelz <121945980+I-asked@users.noreply.github.com> Date: Fri, 3 May 2024 16:21:17 +0200 Subject: [PATCH] Use modern dbus-java fork, add experimental D-Bus MediaService --- app/build.gradle.kts | 22 +- app/src/main/cpp/build_depends.sh | 4 +- app/src/main/java/cx/ath/matthew/cgi/CGI.java | 565 -------- .../cx/ath/matthew/cgi/CGIErrorHandler.java | 41 - .../matthew/cgi/CGIHeaderSentException.java | 39 - .../cgi/CGIInvalidContentFormatException.java | 39 - .../java/cx/ath/matthew/cgi/CGITools.java | 48 - .../java/cx/ath/matthew/cgi/CheckBox.java | 46 - .../ath/matthew/cgi/DefaultErrorHandler.java | 67 - .../java/cx/ath/matthew/cgi/DisplayField.java | 46 - .../java/cx/ath/matthew/cgi/DropDown.java | 131 -- .../main/java/cx/ath/matthew/cgi/Field.java | 38 - .../java/cx/ath/matthew/cgi/HTMLForm.java | 141 -- .../java/cx/ath/matthew/cgi/HiddenField.java | 46 - .../cx/ath/matthew/cgi/MultipleDropDown.java | 115 -- .../java/cx/ath/matthew/cgi/NewTable.java | 42 - .../java/cx/ath/matthew/cgi/Password.java | 46 - .../main/java/cx/ath/matthew/cgi/Radio.java | 46 - .../java/cx/ath/matthew/cgi/SubmitButton.java | 54 - .../java/cx/ath/matthew/cgi/TextArea.java | 57 - .../java/cx/ath/matthew/cgi/TextField.java | 69 - .../main/java/cx/ath/matthew/cgi/testcgi.java | 78 -- .../main/java/cx/ath/matthew/debug/Debug.java | 617 --------- .../main/java/cx/ath/matthew/debug/Debug.jpp | 597 --------- .../java/cx/ath/matthew/io/DOMPrinter.java | 114 -- .../cx/ath/matthew/io/ExecInputStream.java | 142 --- .../cx/ath/matthew/io/ExecOutputStream.java | 137 -- .../java/cx/ath/matthew/io/InOutCopier.java | 115 -- .../cx/ath/matthew/io/TeeInputStream.java | 155 --- .../cx/ath/matthew/io/TeeOutputStream.java | 141 -- app/src/main/java/cx/ath/matthew/io/test.java | 48 - .../main/java/cx/ath/matthew/io/test2.java | 39 - .../main/java/cx/ath/matthew/io/test3.java | 45 - .../matthew/unix/NotConnectedException.java | 37 - .../cx/ath/matthew/unix/USInputStream.java | 84 -- .../cx/ath/matthew/unix/USOutputStream.java | 69 - .../cx/ath/matthew/unix/UnixIOException.java | 44 - .../cx/ath/matthew/unix/UnixServerSocket.java | 129 -- .../java/cx/ath/matthew/unix/UnixSocket.java | 320 ----- .../ath/matthew/unix/UnixSocketAddress.java | 85 -- .../main/java/cx/ath/matthew/unix/java-unix.h | 112 -- .../java/cx/ath/matthew/unix/testclient.java | 51 - .../java/cx/ath/matthew/unix/testserver.java | 55 - .../java/cx/ath/matthew/utils/Hexdump.java | 149 --- .../sync/connectivity/MediaService.java | 343 ----- .../connectivity/NotificationService.java | 143 --- .../sync/connectivity/SlirpService.java | 102 +- .../sync/dbus/DBusNotificationService.java | 169 --- ...ovider.java => IDBusConnectionCallback.kt} | 13 +- .../sync/dbus/IDBusConnectionProvider.kt | 25 + .../org/asteroidos/sync/dbus/MediaService.kt | 397 ++++++ .../sync/dbus/NotificationService.kt | 138 ++ .../asteroidos/sync/dbus/package-info.java | 19 + .../IMediaService.kt} | 14 +- .../asteroidos/sync/media/MediaSupervisor.kt | 126 ++ .../sync/services/SynchronizationService.java | 13 +- app/src/main/java/org/freedesktop/DBus.java | 490 ------- .../freedesktop/GetNotificationsStruct.java | 69 + .../GetServerInformationTuple.java | 56 + .../java/org/freedesktop/Notifications.java | 93 +- .../freedesktop/dbus/AbstractConnection.java | 1030 --------------- .../java/org/freedesktop/dbus/ArrayFrob.java | 173 --- .../java/org/freedesktop/dbus/BusAddress.java | 41 - .../org/freedesktop/dbus/CallbackHandler.java | 22 - .../java/org/freedesktop/dbus/Container.java | 88 -- .../org/freedesktop/dbus/DBusAsyncReply.java | 111 -- .../org/freedesktop/dbus/DBusCallInfo.java | 51 - .../org/freedesktop/dbus/DBusConnection.java | 780 ------------ .../org/freedesktop/dbus/DBusInterface.java | 31 - .../freedesktop/dbus/DBusInterfaceName.java | 27 - .../java/org/freedesktop/dbus/DBusMap.java | 152 --- .../org/freedesktop/dbus/DBusMatchRule.java | 143 --- .../org/freedesktop/dbus/DBusMemberName.java | 27 - .../freedesktop/dbus/DBusSerializable.java | 38 - .../org/freedesktop/dbus/DBusSigHandler.java | 25 - .../java/org/freedesktop/dbus/DBusSignal.java | 259 ---- .../freedesktop/dbus/DirectConnection.java | 251 ---- .../org/freedesktop/dbus/EfficientMap.java | 116 -- .../org/freedesktop/dbus/EfficientQueue.java | 107 -- .../main/java/org/freedesktop/dbus/Error.java | 142 --- .../org/freedesktop/dbus/ExportedObject.java | 166 --- .../java/org/freedesktop/dbus/Gettext.java | 33 - .../org/freedesktop/dbus/InternalSignal.java | 20 - .../org/freedesktop/dbus/Marshalling.java | 626 --------- .../java/org/freedesktop/dbus/Message.java | 1132 ----------------- .../org/freedesktop/dbus/MessageReader.java | 175 --- .../org/freedesktop/dbus/MessageWriter.java | 68 - .../java/org/freedesktop/dbus/MethodCall.java | 126 -- .../org/freedesktop/dbus/MethodReturn.java | 69 - .../org/freedesktop/dbus/MethodTuple.java | 38 - .../java/org/freedesktop/dbus/ObjectPath.java | 23 - .../java/org/freedesktop/dbus/ObjectTree.java | 163 --- .../main/java/org/freedesktop/dbus/Path.java | 40 - .../java/org/freedesktop/dbus/Position.java | 28 - .../dbus/RemoteInvocationHandler.java | 191 --- .../org/freedesktop/dbus/RemoteObject.java | 56 - .../org/freedesktop/dbus/SignalTuple.java | 51 - .../org/freedesktop/dbus/StrongReference.java | 43 - .../java/org/freedesktop/dbus/Struct.java | 23 - .../java/org/freedesktop/dbus/Transport.java | 827 ------------ .../main/java/org/freedesktop/dbus/Tuple.java | 24 - .../org/freedesktop/dbus/TypeSignature.java | 37 - .../java/org/freedesktop/dbus/UInt16.java | 79 -- .../java/org/freedesktop/dbus/UInt32.java | 83 -- .../java/org/freedesktop/dbus/UInt64.java | 151 --- .../java/org/freedesktop/dbus/Variant.java | 112 -- .../java/org/freedesktop/dbus/bin/Caller.java | 83 -- .../freedesktop/dbus/bin/CreateInterface.java | 711 ----------- .../org/freedesktop/dbus/bin/DBusDaemon.java | 878 ------------- .../dbus/bin/IdentifierMangler.java | 43 - .../dbus/bin/IterableNodeList.java | 29 - .../org/freedesktop/dbus/bin/ListDBus.java | 74 -- .../dbus/bin/NodeListIterator.java | 38 - .../freedesktop/dbus/bin/StructStruct.java | 54 - .../freedesktop/dbus/connections/SASL.java | 825 ++++++++++++ .../impl/AndroidDBusConnectionBuilder.java | 227 ++++ .../dbus/exceptions/DBusException.java | 26 - .../exceptions/DBusExecutionException.java | 40 - .../dbus/exceptions/FatalDBusException.java | 20 - .../dbus/exceptions/FatalException.java | 15 - .../exceptions/InternalMessageException.java | 20 - .../dbus/exceptions/MarshallingException.java | 20 - .../exceptions/MessageFormatException.java | 23 - .../MessageProtocolVersionException.java | 22 - .../dbus/exceptions/MessageTypeException.java | 22 - .../dbus/exceptions/NonFatalException.java | 15 - .../dbus/exceptions/NotConnected.java | 23 - .../exceptions/UnknownTypeCodeException.java | 21 - .../freedesktop/dbus/test/ProfileStruct.java | 32 - .../org/freedesktop/dbus/test/Profiler.java | 40 - .../dbus/test/ProfilerInstance.java | 28 - .../freedesktop/dbus/test/TestException.java | 24 - .../dbus/test/TestNewInterface.java | 26 - .../dbus/test/TestRemoteInterface.java | 57 - .../dbus/test/TestRemoteInterface2.java | 54 - .../dbus/test/TestSerializable.java | 48 - .../dbus/test/TestSignalInterface.java | 97 -- .../dbus/test/TestSignalInterface2.java | 45 - .../org/freedesktop/dbus/test/TestStruct.java | 32 - .../freedesktop/dbus/test/TestStruct2.java | 31 - .../freedesktop/dbus/test/TestStruct3.java | 30 - .../org/freedesktop/dbus/test/TestTuple.java | 30 - .../dbus/test/TwoPartInterface.java | 29 - .../freedesktop/dbus/test/TwoPartObject.java | 18 - .../dbus/test/cross_test_client.java | 513 -------- .../dbus/test/cross_test_server.java | 344 ----- .../org/freedesktop/dbus/test/profile.java | 381 ------ .../java/org/freedesktop/dbus/test/test.java | 965 -------------- .../freedesktop/dbus/test/test_low_level.java | 56 - .../dbus/test/test_p2p_client.java | 42 - .../dbus/test/test_p2p_server.java | 94 -- .../dbus/test/two_part_test_client.java | 42 - .../dbus/test/two_part_test_server.java | 55 - .../freedesktop/dbus/types/DBusListType.java | 44 - .../freedesktop/dbus/types/DBusMapType.java | 47 - .../dbus/types/DBusStructType.java | 44 - app/src/main/java/org/mpris/MediaPlayer2.java | 60 + .../java/org/mpris/mediaplayer2/Player.java | 112 ++ build.gradle.kts | 4 +- gradle.properties | 3 + gradle/wrapper/gradle-wrapper.properties | 2 +- 161 files changed, 2224 insertions(+), 19707 deletions(-) delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/CGI.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/CGITools.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/CheckBox.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/DisplayField.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/DropDown.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/Field.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/HTMLForm.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/HiddenField.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/MultipleDropDown.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/NewTable.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/Password.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/Radio.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/SubmitButton.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/TextArea.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/TextField.java delete mode 100644 app/src/main/java/cx/ath/matthew/cgi/testcgi.java delete mode 100644 app/src/main/java/cx/ath/matthew/debug/Debug.java delete mode 100644 app/src/main/java/cx/ath/matthew/debug/Debug.jpp delete mode 100644 app/src/main/java/cx/ath/matthew/io/DOMPrinter.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/ExecInputStream.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/ExecOutputStream.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/InOutCopier.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/TeeInputStream.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/TeeOutputStream.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/test.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/test2.java delete mode 100644 app/src/main/java/cx/ath/matthew/io/test3.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/NotConnectedException.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/USInputStream.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/USOutputStream.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/UnixIOException.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/UnixServerSocket.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/UnixSocket.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/UnixSocketAddress.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/java-unix.h delete mode 100644 app/src/main/java/cx/ath/matthew/unix/testclient.java delete mode 100644 app/src/main/java/cx/ath/matthew/unix/testserver.java delete mode 100644 app/src/main/java/cx/ath/matthew/utils/Hexdump.java delete mode 100644 app/src/main/java/org/asteroidos/sync/connectivity/MediaService.java delete mode 100644 app/src/main/java/org/asteroidos/sync/connectivity/NotificationService.java delete mode 100644 app/src/main/java/org/asteroidos/sync/dbus/DBusNotificationService.java rename app/src/main/java/org/asteroidos/sync/dbus/{IDBusConnectionProvider.java => IDBusConnectionCallback.kt} (72%) create mode 100644 app/src/main/java/org/asteroidos/sync/dbus/IDBusConnectionProvider.kt create mode 100644 app/src/main/java/org/asteroidos/sync/dbus/MediaService.kt create mode 100644 app/src/main/java/org/asteroidos/sync/dbus/NotificationService.kt create mode 100644 app/src/main/java/org/asteroidos/sync/dbus/package-info.java rename app/src/main/java/org/asteroidos/sync/{dbus/IDBusConnectionCallback.java => media/IMediaService.kt} (73%) create mode 100644 app/src/main/java/org/asteroidos/sync/media/MediaSupervisor.kt delete mode 100644 app/src/main/java/org/freedesktop/DBus.java create mode 100644 app/src/main/java/org/freedesktop/GetNotificationsStruct.java create mode 100644 app/src/main/java/org/freedesktop/GetServerInformationTuple.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/AbstractConnection.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/ArrayFrob.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/BusAddress.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/CallbackHandler.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Container.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusAsyncReply.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusCallInfo.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusConnection.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusInterface.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusInterfaceName.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusMap.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusMatchRule.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusMemberName.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusSerializable.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusSigHandler.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DBusSignal.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/DirectConnection.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/EfficientMap.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/EfficientQueue.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Error.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/ExportedObject.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Gettext.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/InternalSignal.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Marshalling.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Message.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/MessageReader.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/MessageWriter.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/MethodCall.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/MethodReturn.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/MethodTuple.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/ObjectPath.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/ObjectTree.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Path.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Position.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/RemoteInvocationHandler.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/RemoteObject.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/SignalTuple.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/StrongReference.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Struct.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Transport.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Tuple.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/TypeSignature.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/UInt16.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/UInt32.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/UInt64.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/Variant.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/Caller.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/CreateInterface.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/DBusDaemon.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/IdentifierMangler.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/IterableNodeList.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/ListDBus.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/NodeListIterator.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/bin/StructStruct.java create mode 100644 app/src/main/java/org/freedesktop/dbus/connections/SASL.java create mode 100644 app/src/main/java/org/freedesktop/dbus/connections/impl/AndroidDBusConnectionBuilder.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/DBusException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/DBusExecutionException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/FatalDBusException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/FatalException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/InternalMessageException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/MarshallingException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/MessageFormatException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/MessageProtocolVersionException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/MessageTypeException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/NonFatalException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/NotConnected.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/exceptions/UnknownTypeCodeException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/ProfileStruct.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/Profiler.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/ProfilerInstance.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestException.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestNewInterface.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface2.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestSerializable.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestSignalInterface.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestSignalInterface2.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestStruct.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestStruct2.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestStruct3.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TestTuple.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TwoPartInterface.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/TwoPartObject.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/cross_test_client.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/cross_test_server.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/profile.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/test.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/test_low_level.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/test_p2p_client.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/test_p2p_server.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/two_part_test_client.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/test/two_part_test_server.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/types/DBusListType.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/types/DBusMapType.java delete mode 100644 app/src/main/java/org/freedesktop/dbus/types/DBusStructType.java create mode 100644 app/src/main/java/org/mpris/MediaPlayer2.java create mode 100644 app/src/main/java/org/mpris/mediaplayer2/Player.java diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3c8749cb..a63f3c36 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,19 +1,22 @@ plugins { id("com.android.application") + kotlin("android") } android { - compileSdk = 33 - buildToolsVersion = "30.0.3" + compileSdk = 34 defaultConfig { applicationId = "org.asteroidos.sync" minSdk = 24 - targetSdk = 33 + targetSdk = 34 versionCode = 29 versionName = "0.29" ndk.abiFilters.clear() ndk.abiFilters.add("arm64-v8a") + ndk.abiFilters.add("armeabi-v7a") + ndk.abiFilters.add("x86") + ndk.abiFilters.add("x86_64") externalNativeBuild { cmake { cppFlags += "" @@ -39,7 +42,7 @@ android { srcDir("src/main/lib/powerampapi/poweramp_api_lib/res/") } jniLibs { - srcDir("/work/android-root/lib") + srcDir("/tmp/android-root/lib") } } } @@ -48,6 +51,10 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlinOptions { + jvmTarget = "17" + } + lint { checkReleaseBuilds = true disable += "MissingTranslation" @@ -80,4 +87,11 @@ dependencies { implementation("no.nordicsemi.android.support.v18:scanner:1.6.0") implementation("no.nordicsemi.android:ble:2.7.2") implementation("com.google.guava:guava:33.1.0-android") + implementation("com.github.hypfvieh:dbus-java-core:5.0.0") + implementation("com.github.hypfvieh:dbus-java-transport-tcp:5.0.0") + implementation("androidx.media3:media3-session:1.3.1") + implementation("androidx.media3:media3-common:1.3.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1-Beta") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.8.1-Beta") + } diff --git a/app/src/main/cpp/build_depends.sh b/app/src/main/cpp/build_depends.sh index 2ddd3e14..fec8465f 100755 --- a/app/src/main/cpp/build_depends.sh +++ b/app/src/main/cpp/build_depends.sh @@ -118,7 +118,7 @@ EOF. +++ meson.build 2024-04-27 11:44:38.569868768 +0200 @@ -2170 +2170 @@ - libiconv = dependency('iconv') -+ libiconv = [cc.find_library('iconv', required : true, dirs : ['/work/android-root/lib'])] ++ libiconv = [cc.find_library('iconv', required : true, dirs : ['${PREFIX}/lib/${ABI}'])] EOF. @@ -130,4 +130,4 @@ EOF. >&2 ninja -C ./_builddir/ install >&2 echo "All depends ready" -popd \ No newline at end of file +popd diff --git a/app/src/main/java/cx/ath/matthew/cgi/CGI.java b/app/src/main/java/cx/ath/matthew/cgi/CGI.java deleted file mode 100644 index b63fffa8..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/CGI.java +++ /dev/null @@ -1,565 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - -package cx.ath.matthew.cgi; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.text.DateFormat; -import java.text.SimpleDateFormat; - -/** - * This is the main class you have to extend with your CGI program. - * You should implement the cgi() method. - * - * @author Matthew Johnson <src@matthew.ath.cx> - */ -abstract public class CGI -{ - private CGIErrorHandler errorhandler = new DefaultErrorHandler(); - private boolean headers_sent = false; - private HashMap headers = new HashMap(); - private Vector cookies = new Vector(); - private LinkedList pagedata = new LinkedList(); - private LinkedList rawdata = new LinkedList(); - - private native String getenv(String var); - /** MUST pass String.class and ALWAYS returns a String[] */ - private native Object[] getfullenv(Class c); - private native void setenv(String var, String value); - { - System.loadLibrary("cgi-java"); - } - - /** - * Called by CGIs to send a header to the output - * - * @param variable The header variable to set. - * @param value The value of the variable. - * - * @throws CGIHeaderSentException if the headers have already been sent. - * - * @see #flush - */ - public final void header(String variable, String value) throws CGIHeaderSentException - { - // only send headers once - if (headers_sent) throw new CGIHeaderSentException(); - - // buffer the variable (Map so that each header is only set once) - headers.put(variable.toLowerCase(), value); - } - - /** - * Sets a Cookie in the web browser, with extended attributes. - * Calls header() so must be called before sending any output. - * - * A parameter will not be sent if it is null. - * - * @param variable The cookie variable to set. - * @param value The value of the variable. - * @param path The path that the cookie will be returned for. - * @param domain The domain that the cookie will be returned for. - * @param expires The expiry date of the cookie. - * @param secure Will only send the cookie over HTTPS if this is true. - * - * @throws CGIHeaderSentException if the headers have already been sent. - * - * @see #flush - * @see #header - */ - public final void setcookie(String variable, String value, String path, String domain, Date expires, boolean secure) throws CGIHeaderSentException - { - if (headers_sent) throw new CGIHeaderSentException(); - - //Set-Cookie: NAME=VALUE; expires=DATE; - //path=PATH; domain=DOMAIN_NAME; secure - //Wdy, DD-Mon-YYYY HH:MM:SS GMT - DateFormat df = new SimpleDateFormat("E, dd-MMM-yyyy HH:mm:ss zzz"); - String cookie = variable+"="+value; - if (null != path) cookie += "; path="+path; - if (null != domain) cookie += "; domain="+domain; - if (null != expires) cookie += "; expires="+df.format(expires); - if (secure) cookie += "; secure"; - cookies.add("Set-Cookie: "+ cookie); - } - - /** - * Sets a Cookie in the web browser. - * Calls header() so must be called before sending any output. - * - * @param variable The cookie variable to set. - * @param value The value of the variable. - * - * @throws CGIHeaderSentException if the headers have already been sent. - * - * @see #flush - * @see #header - */ - public final void setcookie(String variable, String value) throws CGIHeaderSentException - { - if (headers_sent) throw new CGIHeaderSentException(); - - //Set-Cookie: NAME=VALUE; expires=DATE; - //path=PATH; domain=DOMAIN_NAME; secure - cookies.add("Set-Cookie: "+ variable+"="+value); - } - - /** - * Called by CGIs to send byte data to the output. - * The data is buffered until the CGI exits, or a call of flush. - * - * @param data The page data. - * @throws CGIInvalidContentFormatException if text data has already been sent. - * - * @see #flush - */ - public final void out(byte[] data) throws CGIInvalidContentFormatException - { - if (pagedata.size() > 0) throw new CGIInvalidContentFormatException(); - rawdata.add(data); - } - - /** - * Called by CGIs to send a string to the output. - * The data is buffered until the CGI exits, or a call of flush. - * - * @param data The page data. - * @throws CGIInvalidContentFormatException if raw data has already been sent. - * - * @see #flush - */ - public final void out(String data) throws CGIInvalidContentFormatException - { - if (rawdata.size() > 0) throw new CGIInvalidContentFormatException(); - pagedata.add(data); - } - - /** - * This will return an OutputStream that you can write data - * directly to. Calling this method will cause the output to be - * flushed and the Headers sent. At the moment this is not buffered - * and will be sent directly to the client. Subsequent calls - * to out() will appear after data written to the output stream. - * - * @see #out - * @return an OutputStream - */ - public final OutputStream getOutputStream() throws IOException - { - flush(); - return System.out; - } - - /** - * Flushes the output. - * Note that you cannot send a header after a flush. - * If you want to send both text and binary data in a page - * you may do so either side of a flush. - * - * @see #header - */ - public final void flush() throws IOException - { - if (!headers_sent) { - // don't send headers again - headers_sent = true; - // send headers - Iterator i = headers.keySet().iterator(); - while (i.hasNext()) { - String key = (String) i.next(); - String value = (String) headers.get(key); - System.out.println(key + ": " + value); - } - // send cookies - i = cookies.iterator(); - while (i.hasNext()) { - System.out.println((String) i.next()); - } - System.out.println(); - } - - // send data - if (pagedata.size() >0) { - Iterator j = pagedata.iterator(); - while (j.hasNext()) { - System.out.println((String) j.next()); - } - pagedata.clear(); - } else if (rawdata.size() > 0) { - Iterator j = rawdata.iterator(); - while (j.hasNext()) { - System.out.write((byte[]) j.next()); - } - pagedata.clear(); - } - System.out.flush(); - } - - /** - * Sets a custom exception handler. - * Gets called when an exception is thrown. - * The default error handler prints the error nicely in HTML - * and then exits gracefully. - * - * @param handler The new exception handler - */ - protected final void setErrorHandler(CGIErrorHandler handler) - { - errorhandler = handler; - } - - /** - * Override this method in your CGI program. - * - * @param POST A Map of variable =$gt; value for the POST variables. - * @param GET A Map of variable =$gt; value for the GET variables. - * @param ENV A Map of variable =$gt; value for the Webserver environment variables. - * @param COOKIES A Map of variable =$gt; value for the browser-sent cookies. - * @param params An array of parameters passed to the CGI (GET with no variable assignments) - * - * @throws Exception You can throw anything, it will be caught by the error handler. - */ - abstract protected void cgi(Map POST, Map GET, Map ENV, Map COOKIES, String[] params) throws Exception; - - /** - * Reads variables from a String like a=b&c=d to a Map {a => b, c => d}. - * - * @param s String to read from. - * @param seperator seperator character between variables (eg &) - * @param values whether or not this string has values for variables - * - * @return a Map with values, a Vector without - */ - private Object readVariables(String s, char seperator, boolean values) - { - HashMap vars = new HashMap(); - Vector varv = new Vector(); - String temp = ""; - String variable = null; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - if (c == seperator) { // new variable - if (null != temp) temp = temp.trim(); - if (values) { - if (variable == null) {variable = temp; temp = "";} - else variable.trim(); - if (!variable.equals("")) { - Object o = vars.get(variable); - if (o == null) - vars.put(variable.trim(), temp); - else if (o instanceof String) { - LinkedList l = new LinkedList(); - l.add(o); - l.add(temp); - vars.put(variable.trim(), l); - } else if (o instanceof LinkedList) - ((LinkedList) o).add(temp); - } - temp = ""; - } - else { - varv.add(temp); - temp = ""; - } - variable = null; - continue; - } - if (values && c == '=') { - variable = temp; - temp = ""; - continue; - } - switch (c) { - case '%': // escaped character - try { - char a = s.charAt(++i); - char b = s.charAt(++i); - int ch = 0; - switch (a) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - ch += 0x10 * (a - '0'); - break; - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - ch += 0x10 * (a - 'a' + 0xa); - break; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - ch += 0x10 * (a - 'A' + 0xA); - break; - } - switch (b) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - ch += (b - '0'); - break; - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - ch += (b - 'a' + 0xa); - break; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - ch += (b - 'A' + 0xA); - break; - } - temp += (char) ch; - } catch (StringIndexOutOfBoundsException SIOOBe) { - // this means someone has included an invalid escape sequence. - // Invalid URIs can just be thrown on the floor. - } - break; - // + is a space - case '+': - temp += ' '; - break; - default: - temp += c; - } - } - if (values) { - if (variable == null) {variable = temp; temp = "";} - else variable.trim(); - //out("DEBUG variable read: "+variable+"/"+temp); - if (!variable.equals("")) { - Object o = vars.get(variable); - if (o == null) - vars.put(variable.trim(), temp); - else if (o instanceof String) { - LinkedList l = new LinkedList(); - l.add(o); - l.add(temp); - vars.put(variable.trim(), l); - } else if (o instanceof LinkedList) - ((LinkedList) o).add(temp); - } - - return vars; - } - else { - varv.add(temp); - return varv; - } - } - - /** - * Sets up the POST variables - */ - private Map getPOST() - { - try { - String s = ""; - while(System.in.available() > 0) - s += (char) System.in.read(); - //out("DEBUG: POST STRING: "+s); - return (Map) readVariables(s, '&', true); - } catch (IOException IOe) { - try { - out("ERROR: IOException: "+IOe); - } catch (CGIInvalidContentFormatException CGIICFe) { - System.err.println("ERROR: IOException: "+IOe); - } - return new HashMap(); - } - } - - /** - * Sets up the COOKIEs - */ - private Map getCOOKIE() - { - String s = getenv("HTTP_COOKIE"); - if (null == s) - return new HashMap(); - else - return (Map) readVariables(s, ';', true); - } - - /** - * Sets up the GET variables - */ - private Map getGET() - { - String s = getenv("QUERY_STRING"); - if (null == s) - return new HashMap(); - else - return (Map) readVariables(s, '&', true); - } - - /** - * Sets up the ENV variables - */ - private Map getENV() - { - Map m = new HashMap(); - String[] env = (String[]) getfullenv(String.class); - for (int i = 0; i < env.length; i++){ - if (null == env[i]) continue; - String[] e = env[i].split("="); - if (1 == e.length) - m.put(e[0], ""); - else - m.put(e[0], e[1]); - } - -/* - m.put("SERVER_SOFTWARE", getenv("SERVER_SOFTWARE")); - m.put("SERVER_NAME", getenv("SERVER_NAME")); - m.put("GATEWAY_INTERFACE", getenv("GATEWAY_INTERFACE")); - m.put("SERVER_PROTOCOL", getenv("SERVER_PROTOCOL")); - m.put("SERVER_PORT", getenv("SERVER_PORT")); - m.put("REQUEST_METHOD", getenv("REQUEST_METHOD")); - m.put("PATH_INFO", getenv("PATH_INFO")); - m.put("PATH_TRANSLATED", getenv("PATH_TRANSLATED")); - m.put("SCRIPT_NAME", getenv("SCRIPT_NAME")); - m.put("QUERY_STRING", getenv("QUERY_STRING")); - m.put("REMOTE_HOST", getenv("REMOTE_HOST")); - m.put("REMOTE_ADDR", getenv("REMOTE_ADDR")); - m.put("AUTH_TYPE", getenv("AUTH_TYPE")); - m.put("REMOTE_USER", getenv("REMOTE_USER")); - m.put("REMOTE_IDENT", getenv("REMOTE_IDENT")); - m.put("CONTENT_TYPE", getenv("CONTENT_TYPE")); - m.put("CONTENT_LENGTH", getenv("CONTENT_LENGTH")); - m.put("HTTP_ACCEPT", getenv("HTTP_ACCEPT")); - m.put("HTTP_USER_AGENT", getenv("HTTP_USER_AGENT")); - m.put("HTTP_COOKIE", getenv("HTTP_COOKIE")); - m.put("HTTP_ACCEPT_CHARSET", getenv("HTTP_ACCEPT_CHARSET")); - m.put("HTTP_ACCEPT_ENCODING", getenv("HTTP_ACCEPT_ENCODING")); - m.put("HTTP_CACHE_CONTROL", getenv("HTTP_CACHE_CONTROL")); - m.put("HTTP_REFERER", getenv("HTTP_REFERER")); - m.put("HTTP_X_FORWARDED_FOR", getenv("HTTP_X_FORWARDED_FOR")); - m.put("HTTP_HOST", getenv("HTTP_HOST")); - m.put("REQUEST_URI", getenv("REQUEST_URI")); - m.put("DOCUMENT_ROOT", getenv("DOCUMENT_ROOT")); - m.put("PATH", getenv("PATH")); - m.put("SERVER_ADDR", getenv("SERVER_ADDR")); - m.put("SCRIPT_FILENAME", getenv("SCRIPT_FILENAME")); - m.put("HTTP_COOKIE2", getenv("HTTP_COOKIE2")); - m.put("HTTP_CONNECTION", getenv("HTTP_CONNECTION")); - m.put("LANG", getenv("LANG")); - m.put("REDIRECT_LANG", getenv("REDIRECT_LANG")); - */ - return m; - } - - /** - * Sets up the param variables - */ - private String[] getParams(String args) - { - Vector v = (Vector) readVariables(args, ',', false); - String[] params = new String[v.size()]; - Iterator i = v.iterator(); - for (int j = 0; j < params.length; j++) - params[j] = (String) i.next(); - return params; - } - - /** - * This method sets up all the CGI variables and calls the cgi() method, then writes out the page data. - */ - public final void doCGI(String[] args) - { - CGI cgiclass = null; - // wrap everything in a try, we need to handle all our own errors. - try { - // setup the CGI variables - Map POST = getPOST(); - Map GET = getGET(); - Map ENV = getENV(); - Map COOKIE = getCOOKIE(); - String[] params = new String[] {}; - if (args.length >= 1) - params = getParams(args[0]); - - // instantiate CGI class - /* Class c = Class.forName(args[0]); - cgiclass = (CGI) c.newInstance(); */ - - // set default headers - /*cgiclass.*/header("Content-type", "text/html"); - - // execute the CGI - /*cgiclass.*/cgi(POST, GET, ENV, COOKIE, params); - - // send the output / remaining output - /*cgiclass.*/flush(); - } - - // yes, we really want to do this. CGI programs can't send errors. Print nicely to the screen. - catch (Exception e) { - errorhandler.print(/*null == cgiclass ? false : cgiclass.*/headers_sent, e); - } - catch (Throwable t) { - t.printStackTrace(); // this is bad enough to produce stderr errors - errorhandler.print(/*null == cgiclass ? false : cgiclass.*/headers_sent, new Exception(t.toString())); - } - } -} - - diff --git a/app/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java b/app/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java deleted file mode 100644 index e0798cb7..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - -package cx.ath.matthew.cgi; - -/** - * Interface to handle exceptions in the CGI. - */ -public interface CGIErrorHandler -{ - /** - * This is called if an exception is not caught in the CGI. - * It should handle printing the error message nicely to the user, - * and then exit gracefully. - */ - public void print(boolean headers_sent, Exception e); -} diff --git a/app/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java b/app/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java deleted file mode 100644 index 4df8cc70..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - -package cx.ath.matthew.cgi; - -/** - * Thrown if the headers have already been sent and CGI.header is called. - */ -public class CGIHeaderSentException extends Exception -{ - public CGIHeaderSentException() - { - super("Headers already sent by CGI"); - } -} diff --git a/app/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java b/app/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java deleted file mode 100644 index 281533d3..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - -package cx.ath.matthew.cgi; - -/** - * Thrown if both raw and text data are set in the same page. - */ -public class CGIInvalidContentFormatException extends Exception -{ - public CGIInvalidContentFormatException() - { - super("Cannot send both raw and text data"); - } -} diff --git a/app/src/main/java/cx/ath/matthew/cgi/CGITools.java b/app/src/main/java/cx/ath/matthew/cgi/CGITools.java deleted file mode 100644 index 9a379459..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/CGITools.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - -package cx.ath.matthew.cgi; - -abstract class CGITools -{ - /** - * Escape a character in a string. - * @param in String to escape in. - * @param c Character to escape. - * @return in with c replaced with \c - */ - public static String escapeChar(String in, char c) - { - String out = ""; - for (int i = 0; i < in.length(); i++) { - if (in.charAt(i) == c) out += '\\'; - out += in.charAt(i); - } - return out; - } -} - diff --git a/app/src/main/java/cx/ath/matthew/cgi/CheckBox.java b/app/src/main/java/cx/ath/matthew/cgi/CheckBox.java deleted file mode 100644 index 350390d4..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/CheckBox.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - - -package cx.ath.matthew.cgi; - -public class CheckBox extends Field -{ - boolean checked; - public CheckBox(String name, String label, boolean checked) - { - this.name = name; - this.label = label; - this.checked = checked; - } - protected String print() - { - return ""; - } -} - - diff --git a/app/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java b/app/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java deleted file mode 100644 index f5b812fd..00000000 --- a/app/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Java CGI Library - * - * Copyright (c) Matthew Johnson 2004 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * 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 OR COPYRIGHT HOLDERS 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. - * - * To Contact the author, please email src@matthew.ath.cx - * - */ - -package cx.ath.matthew.cgi; - -/** - * Interface to handle exceptions in the CGI. - */ -public class DefaultErrorHandler implements CGIErrorHandler -{ - /** - * This is called if an exception is not caught in the CGI. - * It should handle printing the error message nicely to the user, - * and then exit gracefully. - */ - public void print(boolean headers_sent, Exception e) - { - if (!headers_sent) { - System.out.println("Content-type: text/html"); - System.out.println(""); - System.out.println(""); - System.out.println("
"); - System.out.println(""); - System.out.println("Exception Message: "+e.getMessage()); - System.out.println("
"); - System.out.println(""); - System.out.println("Stack Trace:"); - System.out.println("
"); - System.out.println(""); - e.printStackTrace(System.out); - System.out.println(""); - System.out.println("