mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
New features (#110)
* added upload status * added changes for progress bar with more logs and bug fixes, Documentation yet to be added * huge changes that need more doucmenting * added possibility to get profile using NodeID * added fix profile listing user profile information * removed profile image from the explore reult struct * saving current changes * added filter to search based on NodeID * Monday bug fixing * updates to the profile * changes for tracing the blockchain profile image not shown * added condition to ensure TAG is not sent and removed debug prints * updated webapi docs
This commit is contained in:
committed by
GitHub
parent
97c3001596
commit
ae5f1d2fd7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
File Name: Shared Recent.go
|
||||
File Username: Shared Recent.go
|
||||
Copyright: 2021 Peernet Foundation s.r.o.
|
||||
Author: Peter Kleissner
|
||||
*/
|
||||
@@ -18,7 +18,6 @@ func (api *WebapiInstance) queryRecentShared(backend *core.Backend, fileType int
|
||||
if limitPeer == 0 {
|
||||
limitPeer = 1
|
||||
}
|
||||
|
||||
// Assign peer list as an empty array
|
||||
var peerList []*core.PeerInfo
|
||||
|
||||
@@ -44,11 +43,31 @@ func (api *WebapiInstance) queryRecentShared(backend *core.Backend, fileType int
|
||||
}
|
||||
|
||||
var filesFromPeer uint64
|
||||
var Name string
|
||||
|
||||
ProfileNameFound := false
|
||||
|
||||
// First iteration of the entire blockchain to search for the profile
|
||||
// image and Username of the user
|
||||
for blockN1 := peer.BlockchainHeight - 1; blockN1 > 0; blockN1-- {
|
||||
blockDecoded, _, found, _ := backend.ReadBlock(peer.PublicKey, peer.BlockchainVersion, blockN1)
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
// Adding profile image and Username to the output
|
||||
for raw := range blockDecoded.Block.RecordsRaw {
|
||||
if blockDecoded.Block.RecordsRaw[raw].Type == blockchain.ProfileName && !ProfileNameFound {
|
||||
Name = string(blockDecoded.Block.RecordsRaw[raw].Data[:])
|
||||
ProfileNameFound = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// decode blocks from top down
|
||||
blockLoop:
|
||||
for blockN := peer.BlockchainHeight - 1; blockN > 0; blockN-- {
|
||||
blockDecoded, _, found, _ := backend.ReadBlock(peer.PublicKey, peer.BlockchainVersion, blockN)
|
||||
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
@@ -62,6 +81,8 @@ func (api *WebapiInstance) queryRecentShared(backend *core.Backend, fileType int
|
||||
file.Tags = append(file.Tags, blockchain.TagFromText(blockchain.TagSharedByGeoIP, sharedByGeoIP))
|
||||
}
|
||||
|
||||
file.Username = Name
|
||||
|
||||
// found a new file! append.
|
||||
if filesFromPeer < limitPeer {
|
||||
filesFromPeer++
|
||||
|
||||
Reference in New Issue
Block a user