hyphacoop / api.distributed.press

https://distributed.press
GNU Affero General Public License v3.0
77 stars 8 forks source link

Protocol Integration #35

Closed jackyzha0 closed 1 year ago

jackyzha0 commented 1 year ago

Closes https://github.com/hyphacoop/distributed-press-organizing/issues/62

fauno commented 1 year ago

@fauno Heads up, this changes the HTTP API a bit for updating site data.

Could you point me to those changes? I saw there's a change on NewSite and publication changed to a protocolos object of protocol: Boolean pairs?

fauno commented 1 year ago

Could you point me to those changes? I saw there's a change on NewSite and publication changed to a protocolos object of protocol: Boolean pairs?

Nevermind, I'm reading the files :)

fauno commented 1 year ago

i'm having this tsc error when running dev script after the last commit, removing the whole block of sync code con v1/api/sites.ts works for the tests i was doing.

config/sites.ts(34,13): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index ty
pe '{ ipfs: boolean; hyper: boolean; http: boolean; }'.             
  No index signature with a parameter of type 'string' was found on type '{ ipfs: boolean; hyper: boolean; http: boolean; }'.
config/sites.ts(35,27): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index ty
pe 'ProtocolManager'.                                                                                                                   
  No index signature with a parameter of type 'string' was found on type 'ProtocolManager'.
config/sites.ts(37,20): error TS7006: Parameter 'protocolLinks' implicitly has an 'any' type.
config/sites.ts(38,15): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index ty
pe 'Partial<{ ipfs: { gateway: string; cid: string; pubKey: string; } & { link: string; enabled: boolean; }; hyper: { gateway: string; r
aw: string; } & { link: string; enabled: boolean; }; http: {} & { link: string; enabled: boolean; }; }>'.
  No index signature with a parameter of type 'string' was found on type 'Partial<{ ipfs: { gateway: string; cid: string; pubKey: string
; } & { link: string; enabled: boolean; }; hyper: { gateway: string; raw: string; } & { link: string; enabled: boolean; }; http: {} & { 
link: string; enabled: boolean; }; }>'.

not sure if this change affects the api endpoints, i'd have to adapt the client. it seems to work for a nanoid still, but not sure if internally it thinks it's the domain name

-    const id = nanoid()                                                                                                                
+    const id = cfg.domain                                                                                                              
RangerMauve commented 1 year ago

Oh, I messed up some typescript types, working on fixing it now

RangerMauve commented 1 year ago

Just gonna add some more fixes for the protocol stuff first

RangerMauve commented 1 year ago

Make sure to do an npm install call after pulling.

RangerMauve commented 1 year ago

Remaining steps: