Skip to content

Commit

Permalink
Merge branch 'barteron2' into jury-moderation
Browse files Browse the repository at this point in the history
  • Loading branch information
shpingalet007 committed Mar 29, 2024
2 parents 060fc62 + d2f19cf commit 4fa23ba
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 27 deletions.
18 changes: 13 additions & 5 deletions components/application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var application = (function(){

var primary = deep(p, 'history');

var el, ed, application, appdata;
var el, ed, application, appdata, curpath;

var actions = {
gotohome : function(){
Expand Down Expand Up @@ -82,13 +82,16 @@ var application = (function(){
if(!p.data) return
if(!application) return

if (p.application == application.manifest.id && p.data.encoded){

if (p.application == application.manifest.id/* && p.data.encoded*/){

self.app.nav.api.history.addRemoveParameters([], {
p: p.data.encoded
}, {
replaceState: p.data.replace
})

curpath = actions.getpath()

}
},
Expand Down Expand Up @@ -215,6 +218,7 @@ var application = (function(){
},
frameremote : function(clbk){
var src = application.manifest.scope + '/' + (actions.getpath() || application.manifest.start || '')
curpath = actions.getpath()

/*if(window.testpocketnet){
src = src + '?testnetwork=true'
Expand Down Expand Up @@ -309,15 +313,17 @@ var application = (function(){
return
}

if (p && application && application.manifest.id == id) {
if (application && application.manifest.id == id) {

var decoded = actions.getpath()

if (decoded){
if (decoded == curpath) return

curpath = decoded

self.app.apps.emit('changestate', {
route : decoded
}, application.manifest.id)
}


}
Expand Down Expand Up @@ -398,6 +404,8 @@ var application = (function(){

state.load();

curpath = ''

el = {};
el.c = p.el.find('#' + self.map.id);

Expand Down
9 changes: 8 additions & 1 deletion config/Bastyon.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
"turl" : "test.pocketnet.app",
"name" : "Bastyon",
"fullname" : "Bastyon",
"developapps" : [],
"developapps" : [{
"id" : "barteron.pocketnet.app",
"version": "1.0.0",
"scope" : "test.barter.pocketnet.app",
"cantdelete" : true,
"name" : "Barteron",
"grantedPermissions" : ["account", "chat"]
}],
"protocol" : "bastyon",
"support" : "[email protected]",
"lname" : "Dvm Analytics LLC",
Expand Down
196 changes: 194 additions & 2 deletions js/kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,22 @@ Comment = function(txid){
v : []
}

self.info = {
set : function(_v){

if(!_v){
this.v = ''
}
else

this.v = _v

if (self.on.change)
self.on.change('info', this.v)
},
v : ''
}

self.donate = {
set : function(donate){

Expand Down Expand Up @@ -517,6 +533,7 @@ Comment = function(txid){
images : _.map(self.images.v, function(i){
return (i)
}),
info : (self.info.v || '')

}))

Expand All @@ -540,7 +557,8 @@ Comment = function(txid){
r.msgparsed = {
message : self.message.v,
url : self.url.v,
images : self.images.v
images : self.images.v,
info : self.info.v
}
}
else{
Expand All @@ -550,6 +568,7 @@ Comment = function(txid){
images : _.map(self.images.v, function(i){
return (i)
}),
info : self.info.v
})
}

Expand Down Expand Up @@ -589,12 +608,15 @@ Comment = function(txid){
self.images.set(_.map(v.msgparsed.images, function(i){
return decodeURIComponent(i)
}))
self.info.set(v.msgparsed.info)
}

if (v.msgparsed){
self.url.set(v.msgparsed.url)
self.message.set(v.msgparsed.message)
self.images.set(v.msgparsed.images)
self.info.set(v.msgparsed.info)

}

if (v.donate){
Expand Down Expand Up @@ -2227,6 +2249,170 @@ Transaction = function(){

}

/* BARTERON */

brtAccount = function(){
var self = this;

self.address = '';
self.tags = [];
self.geohash = '';
self.static = false;
self.radius = 0;

self.validation = function(){

}

self.serialize = function(){
return self.address +
JSON.stringify({
a: self.tags,
g: self.geohash,
s: self.static,
r: self.radius
});
}

self.export = function(alias){
if(alias){
return {
address: self.address,
tags: self.tags,
geohash: self.geohash,
static: self.static,
radius: self.radius
};
}

return {
s1: self.address,
p: {
s4: JSON.stringify({
a: self.tags,
g: self.geohash,
s: self.static,
r: self.radius
})
}
};
}

self.import = function(d){
self.address = d.address || app.user.address.value;
self.tags = d.tags;
self.geohash = d.geohash;
self.static = d.static;
self.radius = d.radius;
}

self.type = 'brtaccount';

return self;
}

brtOffer = function(){
var self = this;

self.hash = null;
self.address = '';
self.language = '';
self.caption = '';
self.description = '';
self.tag = '';
self.tags = [];
self.condition = [];
self.images = [];
self.geohash = '';
self.price = 0;

self.validation = function(){
if(!self.address) return 'address';
if(!self.language) return 'language';
if(!self.caption) return 'caption';
if(!self.description) return 'description';
if(!self.tag) return 'tag';
if(!self.tags) return 'tags';
if(!self.condition) return 'condition';
if(!self.images) return 'images';
if(!self.geohash) return 'geohash';
if(!(self.price > -1)) return 'price';
}

self.serialize = function(){
return self.address +
(self.hash ?? '') +
self.language +
self.caption +
self.description +
JSON.stringify({
t: self.tag,
a: self.tags,
c: self.condition
}) +
JSON.stringify(self.images) +
self.geohash +
self.price;
}

self.export = function(alias){
if(alias){
return {
address: self.address,
hash: self.hash || null,
language: self.language,
caption: self.caption,
description: self.description,
tag: self.tag,
tags: self.tags,
condition: self.condition,
images: self.images,
geohash: self.geohash,
price: self.price
};
}

return {
s1: self.address,
...(self.hash && { s2: self.hash }),
p: {
s1: self.language,
s2: self.caption,
s3: self.description,
s4: JSON.stringify({
t: self.tag,
a: self.tags,
c: self.condition,
}),
s5: JSON.stringify(self.images),
s6: self.geohash,
i1: self.price
}
};
}

self.import = function(d){
self.address = d.address || app.user.address.value;
self.hash = d.hash || null;
self.language = d.language;
self.caption = d.caption;
self.description = d.description;
self.tag = d.tag;
self.tags = d.tags;
self.condition = d.condition,
self.images = d.images;
self.geohash = d.geohash;
self.price = d.price;
}

self.type = 'brtoffer';

return self;
}


/* ---- */


pUserInfo = function(){

Expand Down Expand Up @@ -3067,6 +3253,7 @@ pComment = function(){
self.url = ''
self.message = ''
self.images = [];
self.info = ''

self.postid = '';
self.id = '';
Expand Down Expand Up @@ -3105,6 +3292,7 @@ pComment = function(){
self.url = v.msgparsed.url;
self.message = v.msgparsed.message
self.images = v.msgparsed.images
self.info = v.msgparsed.info || ''
}

self.postid = v.postid;
Expand Down Expand Up @@ -3169,6 +3357,7 @@ pComment = function(){
message : self.message,
url : self.url,
images : self.images,
info : self.info
},
scoreDown : self.scoreDown,
scoreUp : self.scoreUp,
Expand Down Expand Up @@ -3749,7 +3938,10 @@ kits = {
accDel : DeleteAccount,
transaction : Transaction,
contentDelete : Remove,
accSet : Settings
accSet : Settings,
brtoffer : brtOffer,
brtaccount : brtAccount

},

ini : {
Expand Down
Loading

0 comments on commit 4fa23ba

Please sign in to comment.