Code Monkey home page Code Monkey logo

pushy-console's Introduction

Pushy Console

Pushy Console is a simple GUI application for sending APNs (iOS/macOS/Safari) push notifications using the Pushy library.

Pushy Console

Pushy Console is intended as a tool for developers, and is primarily intended to provide an easy way to send single notifications to specific devices. It is not intended as a tool for use in any production environment, for sending large numbers of notifications, or for automated use. Users who need to send lots of notifications quickly and efficiently should check out the Pushy library.

Getting and running Pushy Console

Pushy Console is currently distributed as a source-only project, and it requires Java 11 or newer to build and run. To get Pushy Console, you'll need to clone the Pushy Console repository. Once you've done that, you can use Maven to run Pushy Console from the command line. Assuming you're already in the Pushy Console directory:

mvn javafx:run

Sending push notifications with Pushy Console

Before you can start sending push notifications, you'll need to follow the instructions in Apple's "Registering Your App with APNs" documentation. When you've done that, you'll have three things you need to send a notification to a device running your app:

  1. APNs client credentials (either a certificate or a signing key).
  2. An APNs "topic" to which you'd like to send a notification. Topics are generally the bundle ID for one of your apps.
  3. A "device token," which specifies the device to which to send a notification.

Pushy Console supports both certificate-based and token-based authentication with the APNs server. Either is just fine from Pushy Console's perspective, and you can have multiple certificates and signing keys in play elsewhere. From a practical perspective:

  • Certificates expire after a year, and can only be used for a specific set of topics associated with a single app. You'll usually need a password to "unlock" a certificate.
  • Signing keys never expire, and can be used for all topics associated with your developer account. You don't need a pasword to use signing keys, but will need to know they key ID and your Apple Developer Team ID.

You can choose a credentials file by clicking the "browse" button next to the "credentials" field in Pushy Console. If you choose a certificate, you'll be prompted for a password. If you choose a signing key, you'll need to provide a key ID and team ID.

Next, you'll need to choose a topic to which to send a notification. If you're using certificate-based authentication, Pushy Console's topic list will be populated automatically with the topics allowed by the chosen certificate. If you've chosen a signing key instead, you'll need to enter the topic (usually your app's bundie ID) manually.

Regardless of the type of credentials you choose, you'll also need to specify a device token and a notification payload. Please see Apple's "Generating a Remote Notification" documentation for details about constructing a payload. As an easy example, though, you might try a payload that includes a simple alert:

{
    "aps": {
        "alert": "Hello from Pushy Console!"
    }
}

With all of the pieces in place, you can click the "send notification" button to send the notification to Apple's servers. The outcome of the delivery attempt will appear in the table at the bottom of the Pushy Console window.

pushy-console's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pushy-console's Issues

Add a "compose payload" view

Constructing APNs payloads is a non-trivial task. Rather than requiring users to manually enter complicated blobs of JSON, we should add some kind of "compose payload" tool.

Scroll the table view to the bottom when new notifications get sent

New notifications are added to the bottom of the notification table view, but the table view doesn't automatically scroll to show the latest additions. We should probably auto-scroll the table if it's already scrolled to the bottom, but leave it where it is otherwise (i.e. the user had manually scrolled back up for some reason).

Pushy Console crashes at startup due to missing locale-specific properties file

C:\Users\wuttke.MEONA\git\pushy-console>java -jar target\pushy-console-0.1-SNAPSHOT.jar
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.
lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$155(LauncherImpl.java:352)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.util.MissingResourceException: Can't find bundle for base name com/turo/pushy/console/pushy-console, locale de_DE
        at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
        at java.util.ResourceBundle.getBundleImpl(Unknown Source)
        at java.util.ResourceBundle.getBundle(Unknown Source)
        at com.turo.pushy.console.PushyConsoleApplication.<clinit>(PushyConsoleApplication.java:51)
        ... 11 more
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.NullPointerException
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        ... 5 more

Add a reasonable menu bar

Pushy Console doesn't need much in the way of a menu bar, but on macOS (at least), the stock menu looks a little unpolished:

default-menu

We should find a way to either set the application name/menu title so it looks reasonable or replace the default menu bar entirely.

Create uber jar

As pushy-console is kind of a utility tool it would be nice to have it as one single file for easier sharing and running. I tried to make an uber jar with maven shade plugin but faced "Invalid signature..." errors due to signed BouncyCastle jars.

For now, I created a PR #15 that copies dependencies into one place and configures MANIFEST of pushy-console jar to make it executable as jar.

Add an "about Pushy Console" dialog

Virtually all desktop applications have an "about this application" dialog that lists, at least, the version of the application and authorship information. We should add one for Pushy, too (possibly as a follow-on to #6 and #7).

Doesn't work on Mac OS X 14.4.1

First, it works on Windows.

But it isn't working on my Mac, probably it's an internal problem of Mac OS X (tested with several Java implementations and versions).

[INFO] --- javafx:0.0.8:run (default-cli) @ pushy-console ---
Apr. 05, 2024 2:22:29 PM com.sun.glass.ui.mac.MacApplication lambda$waitForReactivation$6
WARNUNG: Timeout while waiting for app reactivation
2024-04-05 14:22:29.910 java[6617:290219] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
2024-04-05 14:22:31.001 java[6617:290219] *** Assertion failure in -[_NSTrackingAreaAKViewHelper removeTrackingRect:], _NSTrackingAreaAKManager.m:1804
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff801e137e6 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff801903e9d objc_exception_throw + 48
	2   Foundation                          0x00007ff802e12fe6 -[NSCalendarDate initWithCoder:] + 0
	3   AppKit                              0x00007ff805bf39bc -[_NSTrackingAreaAKViewHelper removeTrackingRect:] + 199
	4   libglass.dylib                      0x000000010bea7449 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 3593
	5   libglass.dylib                      0x000000010beac038 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 23032
	6   AppKit                              0x00007ff8054466ee -[NSView setFrame:] + 347
	7   libglass.dylib                      0x000000010beac095 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 23125
	8   AppKit                              0x00007ff805456722 -[NSView resizeWithOldSuperviewSize:] + 827
	9   AppKit                              0x00007ff805455fc3 -[NSView resizeSubviewsWithOldSize:] + 503
	10  AppKit                              0x00007ff80543673b -[NSView setFrameSize:] + 1461
	11  AppKit                              0x00007ff8054466ee -[NSView setFrame:] + 347
	12  AppKit                              0x00007ff805456722 -[NSView resizeWithOldSuperviewSize:] + 827
	13  AppKit                              0x00007ff805455fc3 -[NSView resizeSubviewsWithOldSize:] + 503
	14  AppKit                              0x00007ff80543673b -[NSView setFrameSize:] + 1461
	15  AppKit                              0x00007ff805454a20 -[NSThemeFrame setFrameSize:] + 466
	16  AppKit                              0x00007ff805454126 -[NSWindow _oldPlaceWindow:fromServer:] + 811
	17  AppKit                              0x00007ff805452ff3 -[NSWindow _setFrameCommon:display:fromServer:] + 3033
	18  libglass.dylib                      0x000000010be9f27f getImage + 6799
	19  libglass.dylib                      0x000000010be9ecec getImage + 5372
	20  libglass.dylib                      0x000000010be9ef59 getImage + 5993
	21  libglass.dylib                      0x000000010beb62ce Java_com_sun_glass_ui_mac_MacWindow__1setBounds2 + 446
	22  ???                                 0x000000011dfd0980 0x0 + 4798089600
	23  ???                                 0x000000011dfcc362 0x0 + 4798071650
	24  ???                                 0x000000011dfcc362 0x0 + 4798071650
	25  ???                                 0x000000011dfcc362 0x0 + 4798071650
	26  ???                                 0x000000011dfcc7ee 0x0 + 4798072814
)
libc++abi: terminating due to uncaught exception of type NSException
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 134 (Exit value: 134)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
    at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:105)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)

Add an application icon

Right now, Pushy Console uses the default application icon for the platform on which it's running. It'd be great to give it a more descriptive/distinctive icon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.