@rmdes/indiekit-endpoint-activitypub 2.10.0 → 2.10.1

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/assets/reader.css CHANGED
@@ -1094,6 +1094,58 @@
1094
1094
  outline-offset: -2px;
1095
1095
  }
1096
1096
 
1097
+ .ap-compose__cw {
1098
+ display: flex;
1099
+ flex-direction: column;
1100
+ gap: var(--space-xs);
1101
+ }
1102
+
1103
+ .ap-compose__cw-toggle {
1104
+ cursor: pointer;
1105
+ display: flex;
1106
+ align-items: center;
1107
+ gap: var(--space-xs);
1108
+ font-size: var(--font-size-s);
1109
+ color: var(--color-on-offset);
1110
+ }
1111
+
1112
+ .ap-compose__cw-input {
1113
+ border: var(--border-width-thin) solid var(--color-outline);
1114
+ border-radius: var(--border-radius-small);
1115
+ background: var(--color-offset);
1116
+ color: var(--color-on-background);
1117
+ font: inherit;
1118
+ font-size: var(--font-size-s);
1119
+ padding: var(--space-s);
1120
+ width: 100%;
1121
+ }
1122
+
1123
+ .ap-compose__cw-input:focus {
1124
+ border-color: var(--color-primary);
1125
+ outline: none;
1126
+ }
1127
+
1128
+ .ap-compose__visibility {
1129
+ border: var(--border-width-thin) solid var(--color-outline);
1130
+ border-radius: var(--border-radius-small);
1131
+ display: flex;
1132
+ flex-wrap: wrap;
1133
+ gap: var(--space-s) var(--space-m);
1134
+ padding: var(--space-m);
1135
+ }
1136
+
1137
+ .ap-compose__visibility legend {
1138
+ font-weight: 600;
1139
+ }
1140
+
1141
+ .ap-compose__visibility-option {
1142
+ cursor: pointer;
1143
+ display: flex;
1144
+ align-items: center;
1145
+ gap: var(--space-xs);
1146
+ font-size: var(--font-size-s);
1147
+ }
1148
+
1097
1149
  .ap-compose__syndication {
1098
1150
  border: var(--border-width-thin) solid var(--color-outline);
1099
1151
  border-radius: var(--border-radius-small);
@@ -168,7 +168,8 @@ export function submitComposeController(mountPath, plugin) {
168
168
  }
169
169
 
170
170
  const { application } = request.app.locals;
171
- const { content } = request.body;
171
+ const { content, visibility, summary } = request.body;
172
+ const cwEnabled = request.body["cw-enabled"];
172
173
  const inReplyTo = request.body["in-reply-to"];
173
174
  const syndicateTo = request.body["mp-syndicate-to"];
174
175
 
@@ -209,6 +210,15 @@ export function submitComposeController(mountPath, plugin) {
209
210
  micropubData.append("in-reply-to", inReplyTo);
210
211
  }
211
212
 
213
+ if (visibility && visibility !== "public") {
214
+ micropubData.append("visibility", visibility);
215
+ }
216
+
217
+ if (cwEnabled && summary && summary.trim()) {
218
+ micropubData.append("summary", summary.trim());
219
+ micropubData.append("sensitive", "true");
220
+ }
221
+
212
222
  if (syndicateTo) {
213
223
  const targets = Array.isArray(syndicateTo)
214
224
  ? syndicateTo
package/locales/en.json CHANGED
@@ -145,7 +145,13 @@
145
145
  "syndicateLabel": "Syndicate to",
146
146
  "submitMicropub": "Post reply",
147
147
  "cancel": "Cancel",
148
- "errorEmpty": "Reply content cannot be empty"
148
+ "errorEmpty": "Reply content cannot be empty",
149
+ "visibilityLabel": "Visibility",
150
+ "visibilityPublic": "Public",
151
+ "visibilityUnlisted": "Unlisted",
152
+ "visibilityFollowers": "Followers only",
153
+ "cwLabel": "Content warning",
154
+ "cwPlaceholder": "Write your warning here…"
149
155
  },
150
156
  "notifications": {
151
157
  "title": "Notifications",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -27,6 +27,18 @@
27
27
  <input type="hidden" name="in-reply-to" value="{{ replyTo }}">
28
28
  {% endif %}
29
29
 
30
+ {# Content warning toggle + summary #}
31
+ <div class="ap-compose__cw">
32
+ <label class="ap-compose__cw-toggle">
33
+ <input type="checkbox" name="cw-enabled" id="cw-toggle"
34
+ onchange="document.getElementById('cw-text').style.display = this.checked ? 'block' : 'none'">
35
+ {{ __("activitypub.compose.cwLabel") }}
36
+ </label>
37
+ <input type="text" name="summary" id="cw-text" class="ap-compose__cw-input"
38
+ placeholder="{{ __('activitypub.compose.cwPlaceholder') }}"
39
+ style="display: none">
40
+ </div>
41
+
30
42
  {# Content textarea #}
31
43
  <div class="ap-compose__editor">
32
44
  <textarea name="content" class="ap-compose__textarea"
@@ -35,6 +47,23 @@
35
47
  required></textarea>
36
48
  </div>
37
49
 
50
+ {# Visibility #}
51
+ <fieldset class="ap-compose__visibility">
52
+ <legend>{{ __("activitypub.compose.visibilityLabel") }}</legend>
53
+ <label class="ap-compose__visibility-option">
54
+ <input type="radio" name="visibility" value="public" checked>
55
+ {{ __("activitypub.compose.visibilityPublic") }}
56
+ </label>
57
+ <label class="ap-compose__visibility-option">
58
+ <input type="radio" name="visibility" value="unlisted">
59
+ {{ __("activitypub.compose.visibilityUnlisted") }}
60
+ </label>
61
+ <label class="ap-compose__visibility-option">
62
+ <input type="radio" name="visibility" value="followers">
63
+ {{ __("activitypub.compose.visibilityFollowers") }}
64
+ </label>
65
+ </fieldset>
66
+
38
67
  {# Syndication targets #}
39
68
  {% if syndicationTargets.length > 0 %}
40
69
  <fieldset class="ap-compose__syndication">