Commit b65df85068d01bbc7fd6b0ba8686cccbae6928ee
profile pics
'Joran committed on 11/15/2017, 1:23:29 AM
Parent: 5d3463a5a812931815b799819ca80c8f2119bda2
Files changed
modules/avatar-image.js | changed |
package-lock.json | changed |
package.json | changed |
src/components/Message.vue | changed |
src/components/Public.vue | changed |
src/plugins/source_observer.js | changed |
.eslintrc.json | added |
modules/avatar-image.js | ||
---|---|---|
@@ -77,28 +77,15 @@ | ||
77 | 77 … | avatars[a.id] = a |
78 | 78 … | }) |
79 | 79 … | ) |
80 | 80 … | }, |
81 | - avatar_image: function (author, classes) { | |
82 | - classes = classes || '' | |
83 | - if(classes && 'string' === typeof classes) classes = '.avatar--'+classes | |
84 | 81 … | |
85 | - function gen (id) { | |
86 | - if(cache[id]) return h('img', {src: cache[id]}) | |
87 | - var img = visualize(new Buffer(author.substring(1), 'base64'), 256) | |
88 | - cache[id] = img.src | |
89 | - return img | |
90 | - } | |
91 | 82 … | |
92 | - var img = ready && avatars[author] ? h('img', {src: api.blob_url(avatars[author].image)}) : gen(author) | |
93 | - | |
94 | - ;(classes || '').split('.').filter(Boolean).forEach(function (c) { | |
95 | - img.classList.add(c) | |
96 | - }) | |
97 | - | |
83 … | + avatar_image: function (author, classes) { | |
84 … | + var img = ready && avatars[author] ? api.blob_url(avatars[author].image) : "" | |
98 | 85 … | if(!ready) |
99 | 86 … | waiting.push(function () { |
100 | - if(avatars[author]) img.src = api.blob_url(avatars[author].image) | |
87 … | + if(avatars[author]) img = api.blob_url(avatars[author].image) | |
101 | 88 … | }) |
102 | 89 … | |
103 | 90 … | return img |
104 | 91 … | } |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 383484 bytes New file size: 390917 bytes |
package.json | ||
---|---|---|
@@ -88,9 +88,8 @@ | ||
88 | 88 … | "vue-rx": "^5.0.0", |
89 | 89 … | "xstream-from-pull-stream": "^1.1.0" |
90 | 90 … | }, |
91 | 91 … | "devDependencies": { |
92 | - "indexhtmlify": "^1.3.1", | |
93 | 92 … | "babel-core": "^6.0.0", |
94 | 93 … | "babel-plugin-transform-runtime": "^6.0.0", |
95 | 94 … | "babel-preset-es2015": "^6.0.0", |
96 | 95 … | "babel-preset-stage-2": "^6.0.0", |
@@ -99,9 +98,15 @@ | ||
99 | 98 … | "browserify": "^13.1.0", |
100 | 99 … | "browserify-hmr": "^0.3.1", |
101 | 100 … | "cross-env": "^2.0.0", |
102 | 101 … | "envify": "^3.4.1", |
102 … | + "eslint-config-standard": "^10.2.1", | |
103 … | + "eslint-plugin-import": "^2.8.0", | |
104 … | + "eslint-plugin-node": "^5.2.1", | |
105 … | + "eslint-plugin-promise": "^3.6.0", | |
106 … | + "eslint-plugin-standard": "^3.0.1", | |
103 | 107 … | "http-server": "^0.9.0", |
108 … | + "indexhtmlify": "^1.3.1", | |
104 | 109 … | "npm-run-all": "^2.3.0", |
105 | 110 … | "proxyquireify": "^3.0.1", |
106 | 111 … | "uglify-js": "^2.5.0", |
107 | 112 … | "vueify": "^9.0.0", |
src/components/Message.vue | |||
---|---|---|---|
@@ -1,16 +1,15 @@ | |||
1 | 1 … | ||
2 | 2 … | <template> | |
3 | 3 … | <div class="media"> | |
4 | - <img :src="profile_image"> | ||
5 | - </img> | ||
4 … | + <img :src="image_url"></img> | ||
6 | 5 … | ||
6 … | + | ||
7 | 7 … | <div class="media-body"> | |
8 | 8 … | <h5 class="mt-0">{{ author }}</h5> | |
9 | 9 … | ||
10 | 10 … | <span v-html="content_text()"></span> | |
11 | 11 … | ||
12 | - | ||
13 | 12 … | <p> | |
14 | 13 … | {{ message.value.content.type() }} | |
15 | 14 … | </p> | |
16 | 15 … | </div> | |
@@ -30,33 +29,30 @@ | |||
30 | 29 … | props: ['message'], | |
31 | 30 … | data () { | |
32 | 31 … | return { | |
33 | 32 … | author: "...", | |
34 | - image_url: "http://via.placeholder.com/90x90", | ||
35 | - api: this.$depject_api, | ||
36 | - | ||
33 … | + image_url: "http://via.placeholder.com/90x90" | ||
37 | 34 … | } | |
38 | 35 … | }, | |
39 | - subscriptions: function () { | ||
40 | - // var obj = { | ||
41 | - // debugger | ||
42 | - | ||
43 | - // profile_image: Rx.Observable.bindCallback( this.api.avatar_image[0].bind(this) )('@ywmhh72dezK+GrK+/QiYOJ0dKWVuGA/AkpOB/wrWTgk=.ed25519') | ||
36 … | + computed: { | ||
37 … | + // profile_image: function(){ | ||
38 … | + // // Get blob for about image | ||
39 … | + // // return this.$depject_api.avatar[0]("@TXKFQehlyoSn8UJAIVP/k2BjFINC591MlBC2e2d24mA=.ed25519")} | ||
44 | 40 … | // } | |
45 | - // // debugger | ||
46 | - // | ||
47 | - // return obj | ||
48 | 41 … | }, | |
49 | - computed: { | ||
50 | - profile_image: function(){ | ||
51 | - return vm.$depject_api.blob_url[0]("&aIbhv+YRJ85BAWzI1oCwa9716L5pdvMliMdh4KOT+SE=.sha256") } | ||
52 | - }, | ||
53 | 42 … | methods: { | |
54 | 43 … | setAuthor(err, a){ | |
55 | 44 … | if(a[0] == null) | |
56 | 45 … | return | |
57 | 46 … | this.author = nn( a[0] ).name() | |
58 | 47 … | }, | |
48 … | + | ||
49 … | + set_image_url(err, a){ | ||
50 … | + console.log("Set image URL") | ||
51 … | + console.log(err, a) | ||
52 … | + // this.image_url = a | ||
53 … | + }, | ||
54 … | + | ||
59 | 55 … | // Get markdown formatted version of message content | |
60 | 56 … | content_text() | |
61 | 57 … | { | |
62 | 58 … | return md.block( this.message.value.content.text() ) | |
@@ -65,11 +61,15 @@ | |||
65 | 61 … | updated() { | |
66 | 62 … | // author name | |
67 | 63 … | this.$depject_api.signifier[0]( | |
68 | 64 … | this.message.value.author(), this.setAuthor | |
65 … | + ), | ||
66 … | + | ||
67 … | + // this.$depject_api.avatar[0]("@TXKFQehlyoSn8UJAIVP/k2BjFINC591MlBC2e2d24mA=.ed25519")} | ||
68 … | + // this.image_url = "face" | ||
69 … | + this.image_url = this.$depject_api.avatar_image[0]( | ||
70 … | + this.message.value.author(), this.set_image_url, this.set_image_url | ||
69 | 71 … | ) | |
70 | - | ||
71 | - | ||
72 | 72 … | } | |
73 | 73 … | } | |
74 | 74 … | ||
75 | 75 … | </script> |
src/components/Public.vue | ||
---|---|---|
@@ -17,14 +17,15 @@ | ||
17 | 17 … | }, |
18 | 18 … | subscriptions: function () { |
19 | 19 … | return { |
20 | 20 … | messages: this.$observers.accumulated_observable( |
21 | - this.$depject_api.sbot_log[0]( { limit: 10, reverse: true, live: true } ) | |
21 … | + this.$depject_api.sbot_log[0]( | |
22 … | + { limit: 10, reverse: true, live: true } | |
23 … | + ) | |
22 | 24 … | ) |
23 | 25 … | } |
24 | 26 … | } |
25 | 27 … | } |
26 | 28 … | </script> |
27 | 29 … | |
28 | 30 … | <style scoped> |
29 | - | |
30 | 31 … | </style> |
Built with git-ssb-web