Change to remove whoami() calls

This commit is contained in:
Christian Bundy 2019-12-07 17:01:04 -08:00
parent 05a4c76ca4
commit 2ee4ece1c1
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
5 changed files with 14 additions and 25 deletions

View File

@ -27,7 +27,6 @@
"ssbc",
"summerfruit",
"unfollow",
"unikitty",
"whoami"
"unikitty"
]
}

View File

@ -5,7 +5,7 @@ const cooler = require('./lib/cooler')
module.exports = {
isFollowing: async (feedId) => {
const ssb = await cooler.connect()
const { id } = await cooler.get(ssb.whoami)
const { id } = ssb
const isFollowing = await cooler.get(
ssb.friends.isFollowing,
@ -18,7 +18,7 @@ module.exports = {
},
getRelationship: async (feedId) => {
const ssb = await cooler.connect()
const { id } = await cooler.get(ssb.whoami)
const { id } = ssb
if (feedId === id) {
return 'this is you'

View File

@ -29,7 +29,6 @@ const rawConnect = () => new Promise((resolve, reject) => {
messagesByType: 'source',
publish: 'async',
status: 'async',
whoami: 'sync',
tangle: { branch: 'async' },
query: { read: 'source' },
friends: {

View File

@ -6,8 +6,8 @@ const pull = require('pull-stream')
module.exports = {
myFeedId: async () => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
return whoami.id
const { id } = ssb
return id
},
get: async (msgId) => {
const ssb = await cooler.connect()

View File

@ -170,8 +170,7 @@ const post = {
fromFeed: async (feedId, customOptions = {}) => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const options = configure({ id: feedId }, customOptions)
const source = await cooler.read(
@ -200,8 +199,7 @@ const post = {
mentionsMe: async (customOptions = {}) => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const query = [{
$filter: {
@ -222,8 +220,7 @@ const post = {
fromHashtag: async (hashtag, customOptions = {}) => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const query = [{
$filter: {
@ -288,8 +285,7 @@ const post = {
search: async ({ query }) => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const options = configure({
query
@ -322,8 +318,7 @@ const post = {
latest: async () => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const options = configure({
type: 'post',
@ -368,8 +363,7 @@ const post = {
throw new Error('invalid period')
}
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const now = new Date()
const earliest = Number(now) - (1000 * 60 * 60 * 24 * periodDict[period])
@ -476,8 +470,7 @@ const post = {
debug('thread: %s', msgId)
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const options = configure({ id: msgId }, customOptions)
const rawMsg = await cooler.get(ssb.get, options)
@ -652,8 +645,7 @@ const post = {
debug('get: %s', msgId)
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const options = configure({ id: msgId }, customOptions)
const rawMsg = await cooler.get(ssb.get, options)
@ -709,8 +701,7 @@ const post = {
inbox: async (customOptions = {}) => {
const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami)
const myFeedId = whoami.id
const myFeedId = ssb.id
const options = configure({
type: 'post'