diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c9309d..2a444a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: - name: Setup deno uses: denolib/setup-deno@master with: - deno-version: v1.x + deno-version: v1.0.5 - name: Install required build packages (linux) if: startsWith(matrix.os, 'ubuntu') diff --git a/Cargo.lock b/Cargo.lock index 7ab64f3..cad4923 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,14 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" -dependencies = [ - "gimli", -] - [[package]] name = "arrayref" version = "0.3.6" @@ -27,19 +18,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" -[[package]] -name = "backtrace" -version = "0.3.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.11.0" @@ -133,9 +111,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.45.2" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5a38320d0d0baa6496c16ca2eb43386866b740ea3ed21be23f15e6108920004" +checksum = "88bb710ac3916a30de1d3f03f0763c9c0ed5100473687f95ddb37df7de661d0c" dependencies = [ "downcast-rs", "futures 0.3.5", @@ -149,7 +127,7 @@ dependencies = [ [[package]] name = "deno_notify" -version = "0.2.2" +version = "0.3.0" dependencies = [ "deno_core", "futures 0.3.5", @@ -175,15 +153,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6" -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", -] - [[package]] name = "futures" version = "0.1.29" @@ -298,12 +267,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gimli" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" - [[package]] name = "hermit-abi" version = "0.1.13" @@ -395,9 +358,9 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "notify-rust" -version = "4.0.0-rc.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963d07a7dc24a56e2e0036d444b37caf4f0418cfd31c4b4b018ffc92cc06b56b" +checksum = "144acee6a0543dc74893e4b8a33936b5b0a94cc2d4ab024afd0c6daff7afc3c0" dependencies = [ "dbus", "mac-notification-sys", @@ -462,12 +425,6 @@ dependencies = [ "objc", ] -[[package]] -name = "object" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" - [[package]] name = "once_cell" version = "1.4.0" @@ -482,18 +439,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791" +checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40" +checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d" dependencies = [ "proc-macro2", "quote 1.0.6", @@ -577,17 +534,11 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - [[package]] name = "rusty_v8" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb0ad56a57c42009a8d16df5fa94ae882ad0ffe0e88fe1a23b261b3affbccf2" +checksum = "acb51793f34f267b197a6688c986ddcd7a60c94894d77702f1b4a3febf6e1eda" dependencies = [ "bitflags 1.2.1", "cargo_gn", @@ -692,6 +643,26 @@ dependencies = [ "unicode-xid 0.0.4", ] +[[package]] +name = "thiserror" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" +dependencies = [ + "proc-macro2", + "quote 1.0.6", + "syn 1.0.30", +] + [[package]] name = "time" version = "0.1.43" @@ -751,12 +722,12 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "which" -version = "3.1.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +checksum = "bd3edc3cf5458851a4d6a2329232bd5f42c7f9bbe4c4782c4ef9ce37e5d101b2" dependencies = [ - "failure", "libc", + "thiserror", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b4b99d6..ac952d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deno_notify" -version = "0.2.2" +version = "0.3.0" authors = ["Pandawan "] edition = "2018" publish = false @@ -12,7 +12,7 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.5" -deno_core = "0.45.2" -notify-rust = "4.0.0-rc.1" +deno_core = "0.47.1" +notify-rust = "4.0.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/README.md b/README.md index 48a3108..d09b694 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![license](https://img.shields.io/github/license/PandawanFr/deno_notify)](https://github.com/PandawanFr/deno_notify/blob/master/LICENSE) [![build](https://img.shields.io/github/workflow/status/PandawanFr/deno_notify/Build)](https://github.com/PandawanFr/deno_notify/actions) -[![deno version](https://img.shields.io/badge/deno-1.0.0-success)](https://github.com/denoland/deno) +[![deno version](https://img.shields.io/badge/deno-1.0.5-success)](https://github.com/denoland/deno) [![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/deno_notify/ts/mod.ts) Send desktop notifications on all platforms in Deno. @@ -17,15 +17,15 @@ A `prepared.ts` entrypoint is provided which uses [deno-plugin-prepare](https:// *You will need to run using the `--unstable` and `--allow-all` permissions to allow for automatic plugin loading and caching.* ```ts -import { notify } from 'https://deno.land/x/deno_notify@0.2.2/ts/prepared.ts'; +import { notify } from 'https://deno.land/x/deno_notify@0.3.0/ts/prepared.ts'; // Pass a simple message string -notify('Message'); +notify('My message'); // Pass an options object (See mod.ts's NotifyOptions) notify({ - title: 'Hello', - message: 'World', + title: 'A nice title', + message: 'My message', icon: { app: "Terminal", }, @@ -36,12 +36,12 @@ notify({ ### Manual Loading If you prefer to handle the plugin loading manually, you can do so by using the `mod.ts` entrypoint. -Make sure you [download](https://github.com/PandawanFr/deno_notify/releases/tag/0.2.2) the correct plugin for your operating system. +Make sure you [download](https://github.com/PandawanFr/deno_notify/releases/tag/0.3.0) the correct plugin for your operating system. *Because plugin loading is handled manually, you only need the `--unstable` and `--allow-plugin` permissions.* ```ts -import { notify } from 'https://deno.land/x/deno_notify@0.2.2/ts/mod.ts'; +import { notify } from 'https://deno.land/x/deno_notify@0.3.0/ts/mod.ts'; // Load the plugin manually Deno.openPlugin("./libdeno_notify.dylib"); diff --git a/src/lib.rs b/src/lib.rs index 8ff3a17..a21fcdc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ struct SendNotificationResult {} fn op_notify_send( _interface: &mut dyn Interface, data: &[u8], - _zero_copy: Option, + _zero_copy: &mut [ZeroCopyBuf], ) -> Op { let mut response: NotifyResponse = NotifyResponse { err: None, diff --git a/tests/test.ts b/tests/test.ts index bf2c48c..e19c5b8 100644 --- a/tests/test.ts +++ b/tests/test.ts @@ -1,5 +1,5 @@ import { notify, getPluginId } from "../ts/prepared.ts"; -import { assert } from "https://deno.land/std@v0.54.0/testing/asserts.ts"; +import { assert } from "https://deno.land/std@v0.55.0/testing/asserts.ts"; Deno.test("Check plugin id", () => { assert(getPluginId() !== null && getPluginId() !== 0); @@ -8,8 +8,8 @@ Deno.test("Check plugin id", () => { // Need to send complete notification before simple because the icon can't change after being set on mac Deno.test("Send complete notification", () => { notify({ - title: "Hey", - message: "Hello World", + title: "A nice title", + message: "A complete notification", icon: { app: "Safari", }, @@ -17,13 +17,18 @@ Deno.test("Send complete notification", () => { }); }); +Deno.test("Send partial notification", () => { + notify({ + message: "A partial notification" + }); +}); + Deno.test("Send simple notification", () => { - notify("Message"); + notify("A simple notification"); }); /* -Deno.close doesn't work right now, see: https://github.com/denoland/deno/issues/5975 - +// Deno.close doesn't work right now, see: https://github.com/denoland/deno/issues/5975 Deno.test("Load plugin manually", () => { const target = Deno.env.get("DENO_NOTIFY_PLUGIN_BASE"); // Only attempt to load manually if not using online version @@ -33,7 +38,7 @@ Deno.test("Load plugin manually", () => { if (pluginId !== null) { Deno.close(pluginId); - notify('Test Message'); + notify('My message'); } assert(!(Deno as any).core.ops()['notify_send'], "Notify ops still exist after closing"); diff --git a/ts/mod.ts b/ts/mod.ts index ab11073..84459ea 100644 --- a/ts/mod.ts +++ b/ts/mod.ts @@ -2,17 +2,20 @@ import { unwrapResponse, opSync } from "./plugin.ts"; export type Icon = { /** - * Name of the application to use the icon. + * **(MACOS)** Name of the application to use the icon from. + * + * Note: macOS does not explicitly support custom icons. + * To circumvent this, this option pretends your notifications are sent the given application. */ app: string; } | { /** - * File URL to the icon (must be file://). + * **(UNIX, WINDOWS)** A file:// URL to the icon. */ path: string; } | { /** - * Name of the icon in an icon theme, must be freedesktop.org compliant. + * **(UNIX)** Name of the icon in an icon theme, must be freedesktop.org compliant. */ name: string; }; @@ -34,7 +37,7 @@ export interface NotifyOptions { */ icon?: Icon; /** - * Sound to play when showing the notification. + * **(MACOS, WINDOWS)** Sound to play when showing the notification. */ sound?: string; } @@ -53,7 +56,7 @@ export interface NotifyResult {} * @param message * @example * ```ts - * notify('Message'); + * notify('My message'); * ``` */ export function notify(message: string): NotifyResult; diff --git a/ts/prepared.ts b/ts/prepared.ts index b1c566e..c18010e 100644 --- a/ts/prepared.ts +++ b/ts/prepared.ts @@ -1,10 +1,10 @@ import { prepare } from "https://deno.land/x/plugin_prepare@v0.6.0/mod.ts"; -import { resolve } from "https://deno.land/std@v0.54.0/path/mod.ts"; +import { resolve } from "https://deno.land/std@v0.55.0/path/mod.ts"; export * from "./mod.ts"; const releaseUrl = - "https://github.com/PandawanFr/deno_notify/releases/download/0.2.2"; + "https://github.com/PandawanFr/deno_notify/releases/download/0.3.0"; /** * Don't require env permissions if they're not given.