tangled
alpha
login
or
join now
ducky.ws
/
playground
1
fork
atom
Monorepo for @ducky.ws's experiments and scripts
ducky.ws
1
fork
atom
overview
issues
pulls
pipelines
bsky-avatar-clock: add ability to override avatar CID
ducky.ws
1 month ago
b5bb4e70
be546f82
+21
-14
1 changed file
expand all
collapse all
unified
split
code
deno
bsky-avatar-clock.ts
+21
-14
code/deno/bsky-avatar-clock.ts
···
38
let ATPROTO_PASSWORD = getEnvvar("atproto_password");
39
let ATPROTO_PDS = getEnvvar("atproto_pds") || "https://bsky.social";
40
let CRON = getEnvvar("bac_cron") || "*/20 * * * *";
0
41
42
// --- Types / Interfaces ---
43
···
97
const profile = await getBskyProfile(did);
98
let blobCid = null;
99
100
-
if(profile.data.value["x-clock"] === undefined) {
101
-
if(profile.data.value.avatar !== undefined)
102
-
blobCid = (profile.data.value.avatar as Blob).ref.$link;
0
0
0
0
0
103
} else {
104
-
if(profile.data.value["x-clock"].originalAvatar !== undefined)
105
-
blobCid = (profile.data.value["x-clock"].originalAvatar as Blob).ref.$link;
106
}
107
108
if(blobCid !== null)
···
258
"$type": "app.bsky.actor.profile"
259
};
260
261
-
if(currentProfile.data.value["x-clock"] === undefined) {
262
-
const newClock: Clock = {
263
-
originalAvatar: currentProfile.data.value.avatar as Blob,
264
-
status: status
265
-
}
0
266
267
-
newProfileRecord["x-clock"] = newClock;
268
-
} else {
269
-
newProfileRecord["x-clock"] = currentProfile.data.value["x-clock"];
270
-
newProfileRecord["x-clock"].status = status;
0
271
}
272
273
const newProfile = await ATPROTO_CLIENT.call(ComAtprotoRepoApplyWrites, {
···
38
let ATPROTO_PASSWORD = getEnvvar("atproto_password");
39
let ATPROTO_PDS = getEnvvar("atproto_pds") || "https://bsky.social";
40
let CRON = getEnvvar("bac_cron") || "*/20 * * * *";
41
+
let FORCE_BLOB_CID = getEnvvar("force_blob_cid");
42
43
// --- Types / Interfaces ---
44
···
98
const profile = await getBskyProfile(did);
99
let blobCid = null;
100
101
+
if(FORCE_BLOB_CID === null) {
102
+
if(profile.data.value["x-clock"] === undefined) {
103
+
if(profile.data.value.avatar !== undefined)
104
+
blobCid = (profile.data.value.avatar as Blob).ref.$link;
105
+
} else {
106
+
if(profile.data.value["x-clock"].originalAvatar !== undefined)
107
+
blobCid = (profile.data.value["x-clock"].originalAvatar as Blob).ref.$link;
108
+
}
109
} else {
110
+
blobCid = FORCE_BLOB_CID;
0
111
}
112
113
if(blobCid !== null)
···
263
"$type": "app.bsky.actor.profile"
264
};
265
266
+
if(FORCE_BLOB_CID === null) {
267
+
if(currentProfile.data.value["x-clock"] === undefined) {
268
+
const newClock: Clock = {
269
+
originalAvatar: currentProfile.data.value.avatar as Blob,
270
+
status: status
271
+
}
272
273
+
newProfileRecord["x-clock"] = newClock;
274
+
} else {
275
+
newProfileRecord["x-clock"] = currentProfile.data.value["x-clock"];
276
+
newProfileRecord["x-clock"].status = status;
277
+
}
278
}
279
280
const newProfile = await ATPROTO_CLIENT.call(ComAtprotoRepoApplyWrites, {