linkedin-relay-mcp 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/linkedin-relay/SKILL.md +17 -1
- package/dist/cli.js +249 -16
- package/dist/cli.js.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +145 -2
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
|
@@ -125,6 +125,17 @@ The user's own graph and posts, read from the local cache. **Free — no network
|
|
|
125
125
|
back empty, the cache has not been filled: tell the user to run `lnrelay sync connections` (or
|
|
126
126
|
`sync my-posts`) rather than reporting that they have none.
|
|
127
127
|
|
|
128
|
+
### `scheduled` — live, ~1 call per 10 posts. The queue.
|
|
129
|
+
```
|
|
130
|
+
scheduled
|
|
131
|
+
```
|
|
132
|
+
The user's own posts waiting to publish, soonest first: `urn`, `scheduledAt` (ISO), `text`. They are
|
|
133
|
+
**not** in `my-posts` until they go out, so check here before saying nothing is planned. Links in
|
|
134
|
+
`text` show as lnkd.in short links, the way LinkedIn lists them. `text` is null when it could not be
|
|
135
|
+
matched to its post for certain. A scheduled post is cancelled with `lnrelay delete <urn>` and its
|
|
136
|
+
text changed with `lnrelay edit <urn> "<text>"` (both CLI, approved like any write). If `meta.state`
|
|
137
|
+
is not `complete`, the list may be short — say so.
|
|
138
|
+
|
|
128
139
|
### `sync` — CLI-only. Fills the cache.
|
|
129
140
|
```
|
|
130
141
|
lnrelay sync my-posts | lnrelay sync connections [--limit N] [--force]
|
|
@@ -187,7 +198,7 @@ Writes are **not on the MCP surface**. They exist only as CLI commands:
|
|
|
187
198
|
|
|
188
199
|
| command | does |
|
|
189
200
|
|---|---|
|
|
190
|
-
| `lnrelay share "<text>" [--image <path> ... [--alt "…" ...] \| --video <path> \| --document <pdf> --title "…"] [--at "YYYY-MM-DD HH:MM"] [--poll "…" --option "…" --option "…" [--duration 1w]]` | post to their own feed — up to 20 images, one video, or one PDF; `--at` schedules it and LinkedIn publishes it then |
|
|
201
|
+
| `lnrelay share "<text>" [--image <path> ... [--alt "…" ...] \| --video <path> \| --document <pdf> --title "…"] [--at "YYYY-MM-DD HH:MM"] [--poll "…" --option "…" --option "…" [--duration 1w]] [--no-card]` | post to their own feed — up to 20 images, one video, or one PDF; `--at` schedules it and LinkedIn publishes it then; a link in the text gets its preview card unless `--no-card` |
|
|
191
202
|
| `lnrelay comment <activity-urn> "<text>"` | comment on a post |
|
|
192
203
|
| `lnrelay reply <comment-urn> "<text>"` | reply, nested under that comment |
|
|
193
204
|
| `lnrelay edit <comment-urn \| share-urn \| ugcPost-urn> "<text>"` | change the text of their own comment or post |
|
|
@@ -225,6 +236,11 @@ Things worth telling a user who asks:
|
|
|
225
236
|
needed at all: `docs/DECISION-writes.md`.
|
|
226
237
|
- `--image` / `--video` upload over the private API only; `--via oauth` with media is refused. A
|
|
227
238
|
video post comes back as a `urn:li:ugcPost:` rather than `urn:li:share:`.
|
|
239
|
+
- A link in a post's text gets the preview card LinkedIn's composer would show (the first link only,
|
|
240
|
+
and not on a post that already carries images, a video, a PDF or a poll). The plan names the card
|
|
241
|
+
(`card "<title>" (<site>)`), or says LinkedIn has none. If the lookup fails nothing is posted; add
|
|
242
|
+
`--no-card` to post the link as plain text.
|
|
243
|
+
- Scheduled posts are listed by `scheduled` (MCP and CLI), not by `my-posts`.
|
|
228
244
|
- Editing a post replaces its whole text and LinkedIn marks it edited; pass the urn `share` printed
|
|
229
245
|
(or `shareUrn` from `my-posts`), not the activity urn. An @mention in the old text is not kept.
|
|
230
246
|
- A poll takes 2–4 options and runs 1d/3d/1w/2w; it cannot be scheduled yet.
|
package/dist/cli.js
CHANGED
|
@@ -1341,6 +1341,18 @@ var CONTRACTS = {
|
|
|
1341
1341
|
provenance: "verified",
|
|
1342
1342
|
capturedAt: "2026-10-13"
|
|
1343
1343
|
},
|
|
1344
|
+
// The composer's link lookup: a URL in, the article LinkedIn made of it out
|
|
1345
|
+
// (`urn:li:article:<id>`), which a post then carries as ARTICLE media. queryId
|
|
1346
|
+
// from mguttmann/linkedin-internal-api; same article urn the web composer
|
|
1347
|
+
// attached when captured on the date below.
|
|
1348
|
+
urlPreview: {
|
|
1349
|
+
name: "urlPreview",
|
|
1350
|
+
transport: "voyager-graphql",
|
|
1351
|
+
path: `${VOYAGER}/graphql`,
|
|
1352
|
+
queryId: "voyagerContentcreationDashUpdateUrlPreview.b092c1aea4b6c087ec0d09614b3b3320",
|
|
1353
|
+
provenance: "verified",
|
|
1354
|
+
capturedAt: "2026-10-13"
|
|
1355
|
+
},
|
|
1344
1356
|
// limit of this projection is UNRESOLVED — do not treat this endpoint as an
|
|
1345
1357
|
// authoritative "all my posts" until it is settled.
|
|
1346
1358
|
myPosts: {
|
|
@@ -2246,6 +2258,7 @@ var VOYAGER2 = "https://www.linkedin.com/voyager/api";
|
|
|
2246
2258
|
var SHARE_URL = `${VOYAGER2}/contentcreation/normShares`;
|
|
2247
2259
|
var CATEGORY = {
|
|
2248
2260
|
POLL: "URN_REFERENCE",
|
|
2261
|
+
ARTICLE: "ARTICLE",
|
|
2249
2262
|
IMAGE: "IMAGE",
|
|
2250
2263
|
VIDEO: "VIDEO",
|
|
2251
2264
|
DOCUMENT: "NATIVE_DOCUMENT"
|
|
@@ -2318,6 +2331,8 @@ async function share(confirmed, client, bytes) {
|
|
|
2318
2331
|
}
|
|
2319
2332
|
}
|
|
2320
2333
|
const media = [];
|
|
2334
|
+
const { card } = confirmed.payload;
|
|
2335
|
+
if (card !== void 0) media.push({ category: "ARTICLE", urn: card.urn });
|
|
2321
2336
|
const { poll } = confirmed.payload;
|
|
2322
2337
|
if (poll !== void 0) {
|
|
2323
2338
|
const created = await createPoll(poll, client);
|
|
@@ -2446,6 +2461,63 @@ async function createPoll(poll, client) {
|
|
|
2446
2461
|
}
|
|
2447
2462
|
return { ok: true, urn };
|
|
2448
2463
|
}
|
|
2464
|
+
function firstUrl(text2) {
|
|
2465
|
+
const found = text2.match(/https?:\/\/[^\s<>"]+/)?.[0];
|
|
2466
|
+
if (found === void 0) return null;
|
|
2467
|
+
let url = found.replace(/[.,;:!?'"]+$/, "");
|
|
2468
|
+
if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
|
|
2469
|
+
return url;
|
|
2470
|
+
}
|
|
2471
|
+
function urlPreviewUrl(url) {
|
|
2472
|
+
const contract = contractFor("urlPreview");
|
|
2473
|
+
return `${contract?.path}?includeWebMetadata=true&variables=(url:${encodeURIComponent(url)})&queryId=${contract?.queryId}`;
|
|
2474
|
+
}
|
|
2475
|
+
function parseUrlPreview(json) {
|
|
2476
|
+
const error = gqlError(json);
|
|
2477
|
+
if (error !== null) {
|
|
2478
|
+
return { ok: false, code: "SCHEMA_DRIFT", message: `the link preview failed: ${error}` };
|
|
2479
|
+
}
|
|
2480
|
+
const j = json;
|
|
2481
|
+
const elements = j?.data?.data?.contentcreationDashUpdateUrlPreviewByUrl?.elements;
|
|
2482
|
+
if (!Array.isArray(elements)) {
|
|
2483
|
+
return {
|
|
2484
|
+
ok: false,
|
|
2485
|
+
code: "SCHEMA_DRIFT",
|
|
2486
|
+
message: "the link preview response had no preview collection",
|
|
2487
|
+
hint: "Re-capture the urlPreview contract: paste a link into the web composer."
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
if (elements.length === 0) return { ok: true, card: null };
|
|
2491
|
+
const article = (j.included ?? []).find((e) => e.content?.articleComponent?.articleUrn)?.content?.articleComponent;
|
|
2492
|
+
if (article?.articleUrn === void 0) {
|
|
2493
|
+
return {
|
|
2494
|
+
ok: false,
|
|
2495
|
+
code: "SCHEMA_DRIFT",
|
|
2496
|
+
message: "LinkedIn previewed the link but no article came with it"
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
return {
|
|
2500
|
+
ok: true,
|
|
2501
|
+
card: {
|
|
2502
|
+
urn: article.articleUrn,
|
|
2503
|
+
title: article.title?.text ?? "",
|
|
2504
|
+
source: article.subtitle?.text ?? ""
|
|
2505
|
+
}
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
async function fetchLinkCard(url, client) {
|
|
2509
|
+
const result = await client.request({
|
|
2510
|
+
url: urlPreviewUrl(url),
|
|
2511
|
+
spendClass: "page",
|
|
2512
|
+
operation: "link-preview"
|
|
2513
|
+
});
|
|
2514
|
+
if (!result.ok) {
|
|
2515
|
+
const out = { ok: false, code: result.code, message: result.message };
|
|
2516
|
+
if (result.hint !== void 0) out.hint = result.hint;
|
|
2517
|
+
return out;
|
|
2518
|
+
}
|
|
2519
|
+
return parseUrlPreview(result.json);
|
|
2520
|
+
}
|
|
2449
2521
|
|
|
2450
2522
|
// src/commands/gate.ts
|
|
2451
2523
|
import { createInterface } from "readline/promises";
|
|
@@ -2680,8 +2752,103 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
|
|
|
2680
2752
|
return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
|
|
2681
2753
|
}
|
|
2682
2754
|
|
|
2755
|
+
// src/engine/sdui-scheduled.ts
|
|
2756
|
+
var PAGER_ID = "com.linkedin.sdui.pagers.sharing.scheduledPosts";
|
|
2757
|
+
var PAGER_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/pagination?sduiid=${PAGER_ID}`;
|
|
2758
|
+
var SCREEN_ID2 = "com.linkedin.sdui.flagshipnav.sharing.ShareSchedulePostList";
|
|
2759
|
+
function scheduledPageBody(start, count2) {
|
|
2760
|
+
const args = {
|
|
2761
|
+
$type: "proto.sdui.actions.requests.RequestedArguments",
|
|
2762
|
+
requestedStateKeys: [],
|
|
2763
|
+
payload: { start, count: count2, shareLifeCycleState: "ShareLifeCycleState_SCHEDULED" },
|
|
2764
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" }
|
|
2765
|
+
};
|
|
2766
|
+
return {
|
|
2767
|
+
pagerId: PAGER_ID,
|
|
2768
|
+
clientArguments: { ...args, states: [], screenId: SCREEN_ID2, knownTemplateIds: [] },
|
|
2769
|
+
paginationRequest: {
|
|
2770
|
+
$type: "proto.sdui.actions.requests.PaginationRequest",
|
|
2771
|
+
pagerId: PAGER_ID,
|
|
2772
|
+
retryCount: 0,
|
|
2773
|
+
requestedArguments: args
|
|
2774
|
+
}
|
|
2775
|
+
};
|
|
2776
|
+
}
|
|
2777
|
+
var COUNT = /"id":"ShareBoxscheduledPostCount"\}\}\},"value":\{"\$case":"intValue","intValue":(\d+)\}/;
|
|
2778
|
+
var ROW = /"feedUpdateUrn":"(urn:li:(?:share|ugcPost):\d+)","scheduledAtEpochMillis":"(\d+)"/g;
|
|
2779
|
+
var TEXT = /"viewName":"mini-update-container"[\s\S]*?"textProps":\{[^{}]*?"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
2780
|
+
function parseScheduledPage(stream) {
|
|
2781
|
+
const count2 = stream.match(COUNT);
|
|
2782
|
+
if (count2?.[1] === void 0) {
|
|
2783
|
+
return drift("the scheduled-posts page carried no post count");
|
|
2784
|
+
}
|
|
2785
|
+
const claimedCount = Number(count2[1]);
|
|
2786
|
+
const posts = [];
|
|
2787
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2788
|
+
for (const [, urn, at] of stream.matchAll(ROW)) {
|
|
2789
|
+
if (urn === void 0 || seen.has(urn)) continue;
|
|
2790
|
+
seen.add(urn);
|
|
2791
|
+
posts.push({ urn, scheduledAt: Number(at), text: null });
|
|
2792
|
+
}
|
|
2793
|
+
if (claimedCount > 0 && posts.length === 0) {
|
|
2794
|
+
return drift(`LinkedIn counts ${claimedCount} scheduled posts but no row could be read`);
|
|
2795
|
+
}
|
|
2796
|
+
const texts = [...stream.matchAll(TEXT)].map((m) => JSON.parse(`"${m[1]}"`));
|
|
2797
|
+
if (texts.length === posts.length) {
|
|
2798
|
+
posts.forEach((p, i) => {
|
|
2799
|
+
p.text = texts[i] ?? null;
|
|
2800
|
+
});
|
|
2801
|
+
}
|
|
2802
|
+
return { ok: true, claimedCount, posts };
|
|
2803
|
+
}
|
|
2804
|
+
function drift(message) {
|
|
2805
|
+
return {
|
|
2806
|
+
ok: false,
|
|
2807
|
+
code: "SCHEMA_DRIFT",
|
|
2808
|
+
message,
|
|
2809
|
+
hint: 'Re-capture the scheduled list (open "Scheduled" in the composer) with scripts/observe-write.ts.'
|
|
2810
|
+
};
|
|
2811
|
+
}
|
|
2812
|
+
var PAGE_SIZE = 10;
|
|
2813
|
+
var MAX_PAGES = 10;
|
|
2814
|
+
async function fetchScheduled(client, pageSize = PAGE_SIZE) {
|
|
2815
|
+
const posts = [];
|
|
2816
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2817
|
+
let claimedCount = 0;
|
|
2818
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
2819
|
+
const result = await client.request({
|
|
2820
|
+
url: PAGER_URL,
|
|
2821
|
+
method: "POST",
|
|
2822
|
+
body: scheduledPageBody(posts.length, pageSize),
|
|
2823
|
+
spendClass: "page",
|
|
2824
|
+
operation: "scheduled"
|
|
2825
|
+
});
|
|
2826
|
+
if (!result.ok) {
|
|
2827
|
+
const out = { ok: false, code: result.code, message: result.message };
|
|
2828
|
+
if (result.hint !== void 0) out.hint = result.hint;
|
|
2829
|
+
return out;
|
|
2830
|
+
}
|
|
2831
|
+
const parsed = parseScheduledPage(result.classification.raw ?? "");
|
|
2832
|
+
if (!parsed.ok) return parsed;
|
|
2833
|
+
claimedCount = Math.max(claimedCount, parsed.claimedCount);
|
|
2834
|
+
const fresh = parsed.posts.filter((p) => !seen.has(p.urn));
|
|
2835
|
+
for (const p of fresh) {
|
|
2836
|
+
seen.add(p.urn);
|
|
2837
|
+
posts.push(p);
|
|
2838
|
+
}
|
|
2839
|
+
if (posts.length >= claimedCount || fresh.length === 0) break;
|
|
2840
|
+
}
|
|
2841
|
+
const state = posts.length >= claimedCount ? "complete" : "partial";
|
|
2842
|
+
return { ok: true, posts, claimedCount, state };
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2683
2845
|
// src/commands/live.ts
|
|
2684
2846
|
function withSession(command, quiet = false) {
|
|
2847
|
+
const loaded = sessionFor(command);
|
|
2848
|
+
if ("ok" in loaded) return loaded;
|
|
2849
|
+
return { engine: createEngine(loaded.session, void 0, quiet) };
|
|
2850
|
+
}
|
|
2851
|
+
function sessionFor(command) {
|
|
2685
2852
|
const loaded = loadSession();
|
|
2686
2853
|
if (loaded.state === "corrupt") {
|
|
2687
2854
|
return err(
|
|
@@ -2694,7 +2861,7 @@ function withSession(command, quiet = false) {
|
|
|
2694
2861
|
if (loaded.state === "missing") {
|
|
2695
2862
|
return err(command, "AUTH_FAILED", "no session \u2014 run `lnrelay login` first", LAUNCH_HINT);
|
|
2696
2863
|
}
|
|
2697
|
-
return {
|
|
2864
|
+
return { session: loaded.session };
|
|
2698
2865
|
}
|
|
2699
2866
|
function toEnvelope(command, result) {
|
|
2700
2867
|
return err(command, result.code, result.message, result.hint, void 0, result.retryAfterMs);
|
|
@@ -2800,6 +2967,27 @@ async function runReactions(urn, limit, opts = {}) {
|
|
|
2800
2967
|
if (!result.ok) return toEnvelope("reactions", result);
|
|
2801
2968
|
return ok("reactions", { urn: postUrn2, ...collection(result.value, opts) });
|
|
2802
2969
|
}
|
|
2970
|
+
async function runScheduled(quiet = false) {
|
|
2971
|
+
const ctx = sessionFor("scheduled");
|
|
2972
|
+
if ("ok" in ctx) return ctx;
|
|
2973
|
+
const result = await fetchScheduled(createLiveClient(ctx.session, void 0, quiet));
|
|
2974
|
+
if (!result.ok) return err("scheduled", result.code, result.message, result.hint);
|
|
2975
|
+
return ok("scheduled", scheduledData(result));
|
|
2976
|
+
}
|
|
2977
|
+
function scheduledData(result) {
|
|
2978
|
+
return {
|
|
2979
|
+
items: result.posts.map((p) => ({
|
|
2980
|
+
urn: p.urn,
|
|
2981
|
+
scheduledAt: new Date(p.scheduledAt).toISOString(),
|
|
2982
|
+
text: p.text
|
|
2983
|
+
})),
|
|
2984
|
+
meta: {
|
|
2985
|
+
state: result.state,
|
|
2986
|
+
returnedCount: result.posts.length,
|
|
2987
|
+
claimedCount: result.claimedCount
|
|
2988
|
+
}
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2803
2991
|
function normalisePostUrn(input) {
|
|
2804
2992
|
if (input === void 0 || input === "") return void 0;
|
|
2805
2993
|
const found = input.match(/urn:li:(?:activity|ugcPost|share):\d+/);
|
|
@@ -3388,6 +3576,15 @@ var COMMANDS = [
|
|
|
3388
3576
|
risk: "read",
|
|
3389
3577
|
implemented: true
|
|
3390
3578
|
},
|
|
3579
|
+
{
|
|
3580
|
+
name: "scheduled",
|
|
3581
|
+
cost: "1 call per 10 posts",
|
|
3582
|
+
summary: "Your posts waiting to publish, with when. Not in `my-posts` until they go out.",
|
|
3583
|
+
usage: "lnrelay scheduled\n Each row: urn (cancel with `delete`, change with `edit`), scheduledAt, text. Links in\n the text show as lnkd.in short links, as LinkedIn lists them.",
|
|
3584
|
+
audience: ["cli", "mcp"],
|
|
3585
|
+
risk: "read",
|
|
3586
|
+
implemented: true
|
|
3587
|
+
},
|
|
3391
3588
|
{
|
|
3392
3589
|
name: "local",
|
|
3393
3590
|
cost: "free \u2014 local cache",
|
|
@@ -3438,7 +3635,7 @@ var COMMANDS = [
|
|
|
3438
3635
|
name: "share",
|
|
3439
3636
|
cost: "1 call \u2014 write",
|
|
3440
3637
|
summary: "Post to your own feed. Prefers LinkedIn's official OAuth scope, falls back to the private API when no token exists \u2014 the prompt always names which.",
|
|
3441
|
-
usage: 'lnrelay share "<text>" [--image <path> ... [--alt "<text>" ...] | --video <path>\n | --document <pdf> --title "<title>"] [--at "YYYY-MM-DD HH:MM"]\n [--poll "<question>" --option "<a>" --option "<b>" ... [--duration 1d|3d|1w|2w]]\n [--visibility public|connections] [--via oauth|voyager] [--plan | --confirm <token>]\n Approval follows `lnrelay approval`: --plan previews and returns a token without\n sending; --confirm <token> sends it in agent mode. In interactive mode it asks at a\n terminal. --image repeats for up to 20, --alt pairs with it by position (--alt ""\n skips one). --at schedules it (local time, or ISO 8601 with an offset; at least 10\n minutes out); LinkedIn publishes it then, and `lnrelay delete <urn>` cancels it.\n --poll takes 2-4 --option and cannot be scheduled yet. Files, documents, polls and\n
|
|
3638
|
+
usage: 'lnrelay share "<text>" [--image <path> ... [--alt "<text>" ...] | --video <path>\n | --document <pdf> --title "<title>"] [--at "YYYY-MM-DD HH:MM"]\n [--poll "<question>" --option "<a>" --option "<b>" ... [--duration 1d|3d|1w|2w]]\n [--visibility public|connections] [--via oauth|voyager] [--no-card]\n [--plan | --confirm <token>]\n Approval follows `lnrelay approval`: --plan previews and returns a token without\n sending; --confirm <token> sends it in agent mode. In interactive mode it asks at a\n terminal. --image repeats for up to 20, --alt pairs with it by position (--alt ""\n skips one). --at schedules it (local time, or ISO 8601 with an offset; at least 10\n minutes out); LinkedIn publishes it then, and `lnrelay delete <urn>` cancels it.\n --poll takes 2-4 --option and cannot be scheduled yet. The first link in the text\n gets the preview card LinkedIn would show (one extra read, named in the preview);\n --no-card posts it as plain text. Files, documents, polls, cards and scheduling go\n over the private API only.',
|
|
3442
3639
|
audience: ["cli"],
|
|
3443
3640
|
risk: "write",
|
|
3444
3641
|
implemented: true
|
|
@@ -3715,7 +3912,7 @@ function share2(confirmed, token, deps) {
|
|
|
3715
3912
|
// src/engine/sdui-comment.ts
|
|
3716
3913
|
var SDUI_ACTION2 = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
3717
3914
|
var COMMENT_URL = `${SDUI_ACTION2}?sduiid=com.linkedin.sdui.comments.createComment`;
|
|
3718
|
-
var
|
|
3915
|
+
var SCREEN_ID3 = "com.linkedin.sdui.flagshipnav.feed.UpdateDetail";
|
|
3719
3916
|
var STATE_PREFIXES = [
|
|
3720
3917
|
"commentBoxText",
|
|
3721
3918
|
"richCommentBoxText",
|
|
@@ -3806,7 +4003,7 @@ function commentBody(activityId, text2, tokens, feedType) {
|
|
|
3806
4003
|
requestedArguments: {
|
|
3807
4004
|
...args,
|
|
3808
4005
|
states: states(text2, body),
|
|
3809
|
-
screenId:
|
|
4006
|
+
screenId: SCREEN_ID3,
|
|
3810
4007
|
knownTemplateIds: []
|
|
3811
4008
|
}
|
|
3812
4009
|
};
|
|
@@ -3847,7 +4044,7 @@ async function comment(confirmed, client) {
|
|
|
3847
4044
|
|
|
3848
4045
|
// src/engine/sdui-write.ts
|
|
3849
4046
|
var SDUI_ACTION3 = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
3850
|
-
var
|
|
4047
|
+
var SCREEN_ID4 = "com.linkedin.sdui.flagshipnav.feed.UpdateDetail";
|
|
3851
4048
|
var REACTIONS = [
|
|
3852
4049
|
"LIKE",
|
|
3853
4050
|
"PRAISE",
|
|
@@ -3924,7 +4121,7 @@ function sduiBody(op, target, reaction) {
|
|
|
3924
4121
|
requestedArguments: {
|
|
3925
4122
|
...args,
|
|
3926
4123
|
states: [],
|
|
3927
|
-
screenId:
|
|
4124
|
+
screenId: SCREEN_ID4,
|
|
3928
4125
|
knownTemplateIds: []
|
|
3929
4126
|
}
|
|
3930
4127
|
};
|
|
@@ -4216,6 +4413,7 @@ function sharePlan(p) {
|
|
|
4216
4413
|
if (p.media !== void 0) payload.media = p.media;
|
|
4217
4414
|
if (p.scheduledAt !== void 0) payload.scheduledAt = p.scheduledAt;
|
|
4218
4415
|
if (p.poll !== void 0) payload.poll = p.poll;
|
|
4416
|
+
if (p.card !== void 0 && p.card !== null) payload.card = p.card;
|
|
4219
4417
|
const scheduled = p.scheduledAt !== void 0;
|
|
4220
4418
|
return {
|
|
4221
4419
|
action: scheduled ? "schedule a post" : "post to your feed",
|
|
@@ -4226,12 +4424,37 @@ function sharePlan(p) {
|
|
|
4226
4424
|
`audience ${p.visibility}`,
|
|
4227
4425
|
...p.scheduledAt === void 0 ? [] : [whenLine(p.scheduledAt, p.now)],
|
|
4228
4426
|
...p.poll === void 0 ? [] : pollLines(p.poll),
|
|
4229
|
-
...p.media === void 0 ? [] : mediaLines(p.media)
|
|
4427
|
+
...p.media === void 0 ? [] : mediaLines(p.media),
|
|
4428
|
+
...cardLines(p.card)
|
|
4230
4429
|
],
|
|
4231
4430
|
reversibility: scheduled ? "cancel any time before it publishes with `lnrelay delete <urn>`; after that it is public under your name like any post" : "deletable with `lnrelay delete <urn>`, but it is public under your name the moment it lands and anyone who saw it cannot un-see it",
|
|
4232
4431
|
transport: p.transport
|
|
4233
4432
|
};
|
|
4234
4433
|
}
|
|
4434
|
+
function cardLines(card) {
|
|
4435
|
+
if (card === void 0) return [];
|
|
4436
|
+
if (card === null) return ["card none \u2014 LinkedIn has no preview for this link"];
|
|
4437
|
+
return [`card "${card.title}" (${card.source})`];
|
|
4438
|
+
}
|
|
4439
|
+
var liveCardLookup = (url, session) => fetchLinkCard(url, createLiveClient(session));
|
|
4440
|
+
function shareNeeds(files, scheduledAt, poll, cardUrl) {
|
|
4441
|
+
const extra = (poll === void 0 ? 0 : 1) + (cardUrl === null ? 0 : 1);
|
|
4442
|
+
return {
|
|
4443
|
+
voyagerOnly: files !== void 0 || scheduledAt !== void 0 || extra > 0,
|
|
4444
|
+
calls: 2 * (files ?? 0) + extra + 1
|
|
4445
|
+
};
|
|
4446
|
+
}
|
|
4447
|
+
async function cardFor(url, transport, link) {
|
|
4448
|
+
if (url === null || transport.kind !== "voyager") return void 0;
|
|
4449
|
+
const found = await (link.lookup ?? liveCardLookup)(url, transport.session);
|
|
4450
|
+
if (found.ok) return found.card;
|
|
4451
|
+
return err(
|
|
4452
|
+
"share",
|
|
4453
|
+
found.code,
|
|
4454
|
+
`could not look up the card for ${url}: ${found.message}; nothing was posted`,
|
|
4455
|
+
"Re-run later, or add --no-card to post the link as plain text."
|
|
4456
|
+
);
|
|
4457
|
+
}
|
|
4235
4458
|
function pollLines(poll) {
|
|
4236
4459
|
return [
|
|
4237
4460
|
`poll "${poll.question}"`,
|
|
@@ -4312,7 +4535,7 @@ function whenLine(at, now) {
|
|
|
4312
4535
|
const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
|
|
4313
4536
|
return `when ${local} (${zone}) \u2014 ${away}`;
|
|
4314
4537
|
}
|
|
4315
|
-
async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll) {
|
|
4538
|
+
async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
|
|
4316
4539
|
if (text2 === void 0 || text2.trim() === "") {
|
|
4317
4540
|
return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
|
|
4318
4541
|
}
|
|
@@ -4328,14 +4551,12 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
|
|
|
4328
4551
|
via: via2
|
|
4329
4552
|
});
|
|
4330
4553
|
if (pollSpec !== void 0 && "ok" in pollSpec) return pollSpec;
|
|
4331
|
-
const
|
|
4332
|
-
const
|
|
4333
|
-
|
|
4334
|
-
now,
|
|
4335
|
-
voyagerOnly ? "voyager" : via2,
|
|
4336
|
-
2 * (loaded?.approved.length ?? 0) + (pollSpec === void 0 ? 0 : 1) + 1
|
|
4337
|
-
);
|
|
4554
|
+
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text2) : null;
|
|
4555
|
+
const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
|
|
4556
|
+
const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
|
|
4338
4557
|
if ("ok" in ctx) return ctx;
|
|
4558
|
+
const card = await cardFor(cardUrl, ctx.transport, link);
|
|
4559
|
+
if (card !== void 0 && card !== null && "ok" in card) return card;
|
|
4339
4560
|
const plan = sharePlan({
|
|
4340
4561
|
author: authorLine(ctx.transport),
|
|
4341
4562
|
transport: ctx.transport.kind,
|
|
@@ -4344,6 +4565,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
|
|
|
4344
4565
|
media: loaded?.approved,
|
|
4345
4566
|
scheduledAt,
|
|
4346
4567
|
poll: pollSpec,
|
|
4568
|
+
...card === void 0 ? {} : { card },
|
|
4347
4569
|
now
|
|
4348
4570
|
});
|
|
4349
4571
|
const gated = await gate("share", plan, ctx, deps);
|
|
@@ -4734,6 +4956,8 @@ async function dispatch(argv, now) {
|
|
|
4734
4956
|
num(args, "limit") ?? 25,
|
|
4735
4957
|
output(args)
|
|
4736
4958
|
);
|
|
4959
|
+
case "scheduled":
|
|
4960
|
+
return runScheduled(bool(args, "quiet"));
|
|
4737
4961
|
case "sync":
|
|
4738
4962
|
return runSync(args.positionals[0], num(args, "limit") ?? 50, bool(args, "force"), now);
|
|
4739
4963
|
case "login":
|
|
@@ -4843,6 +5067,14 @@ function share3(args, now, deps) {
|
|
|
4843
5067
|
return err("share", "INVALID_INPUT", `--${flag} needs a value`);
|
|
4844
5068
|
}
|
|
4845
5069
|
}
|
|
5070
|
+
if (typeof args.flags["no-card"] === "string") {
|
|
5071
|
+
return err(
|
|
5072
|
+
"share",
|
|
5073
|
+
"INVALID_INPUT",
|
|
5074
|
+
"--no-card takes no value",
|
|
5075
|
+
'put the text first: lnrelay share "<text>" --no-card'
|
|
5076
|
+
);
|
|
5077
|
+
}
|
|
4846
5078
|
const kinds = ["image", "video", "document"].map((flag) => ({ flag, paths: list(args, flag) })).filter((k) => k.paths.length > 0);
|
|
4847
5079
|
if (kinds.length > 1) {
|
|
4848
5080
|
return err(
|
|
@@ -4885,7 +5117,8 @@ function share3(args, now, deps) {
|
|
|
4885
5117
|
surface,
|
|
4886
5118
|
media,
|
|
4887
5119
|
str(args, "at"),
|
|
4888
|
-
poll
|
|
5120
|
+
poll,
|
|
5121
|
+
{ card: !bool(args, "no-card") }
|
|
4889
5122
|
);
|
|
4890
5123
|
}
|
|
4891
5124
|
export {
|