git ssb

3+

dangerousbeans / scuttle-vue



Commit b65df85068d01bbc7fd6b0ba8686cccbae6928ee

profile pics

'
Joran committed on 11/15/2017, 1:23:29 AM
Parent: 5d3463a5a812931815b799819ca80c8f2119bda2

Files changed

modules/avatar-image.jschanged
package-lock.jsonchanged
package.jsonchanged
src/components/Message.vuechanged
src/components/Public.vuechanged
src/plugins/source_observer.jschanged
.eslintrc.jsonadded
modules/avatar-image.jsView
@@ -77,28 +77,15 @@
7777 avatars[a.id] = a
7878 })
7979 )
8080 },
81- avatar_image: function (author, classes) {
82- classes = classes || ''
83- if(classes && 'string' === typeof classes) classes = '.avatar--'+classes
8481
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- }
9182
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) : ""
9885 if(!ready)
9986 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)
10188 })
10289
10390 return img
10491 }
package-lock.jsonView
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.jsonView
@@ -88,9 +88,8 @@
8888 "vue-rx": "^5.0.0",
8989 "xstream-from-pull-stream": "^1.1.0"
9090 },
9191 "devDependencies": {
92- "indexhtmlify": "^1.3.1",
9392 "babel-core": "^6.0.0",
9493 "babel-plugin-transform-runtime": "^6.0.0",
9594 "babel-preset-es2015": "^6.0.0",
9695 "babel-preset-stage-2": "^6.0.0",
@@ -99,9 +98,15 @@
9998 "browserify": "^13.1.0",
10099 "browserify-hmr": "^0.3.1",
101100 "cross-env": "^2.0.0",
102101 "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",
103107 "http-server": "^0.9.0",
108 + "indexhtmlify": "^1.3.1",
104109 "npm-run-all": "^2.3.0",
105110 "proxyquireify": "^3.0.1",
106111 "uglify-js": "^2.5.0",
107112 "vueify": "^9.0.0",
src/components/Message.vueView
@@ -1,16 +1,15 @@
11
22 <template>
33 <div class="media">
4- <img :src="profile_image">
5- </img>
4 + <img :src="image_url"></img>
65
6 +
77 <div class="media-body">
88 <h5 class="mt-0">{{ author }}</h5>
99
1010 <span v-html="content_text()"></span>
1111
12-
1312 <p>
1413 {{ message.value.content.type() }}
1514 </p>
1615 </div>
@@ -30,33 +29,30 @@
3029 props: ['message'],
3130 data () {
3231 return {
3332 author: "...",
34- image_url: "http://via.placeholder.com/90x90",
35- api: this.$depject_api,
36-
33 + image_url: "http://via.placeholder.com/90x90"
3734 }
3835 },
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")}
4440 // }
45- // // debugger
46- //
47- // return obj
4841 },
49- computed: {
50- profile_image: function(){
51- return vm.$depject_api.blob_url[0]("&aIbhv+YRJ85BAWzI1oCwa9716L5pdvMliMdh4KOT+SE=.sha256") }
52- },
5342 methods: {
5443 setAuthor(err, a){
5544 if(a[0] == null)
5645 return
5746 this.author = nn( a[0] ).name()
5847 },
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 +
5955 // Get markdown formatted version of message content
6056 content_text()
6157 {
6258 return md.block( this.message.value.content.text() )
@@ -65,11 +61,15 @@
6561 updated() {
6662 // author name
6763 this.$depject_api.signifier[0](
6864 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
6971 )
70-
71-
7272 }
7373 }
7474
7575 </script>
src/components/Public.vueView
@@ -17,14 +17,15 @@
1717 },
1818 subscriptions: function () {
1919 return {
2020 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 + )
2224 )
2325 }
2426 }
2527 }
2628 </script>
2729
2830 <style scoped>
29-
3031 </style>
src/plugins/source_observer.jsView
@@ -16,8 +16,9 @@
1616 pull.drain(msg => observer.next(msg))
1717 )
1818 }).scan((accumulator, newMsg) => [nn(newMsg), ...accumulator], [])
1919 },
20 +
2021 cb_obs(f, args){
2122 return Rx.Observable.bindCallback(f)(args)
2223 }
2324 }
.eslintrc.jsonView
@@ -1,0 +1,3 @@
1 +{
2 + "extends": "standard"
3 +}

Built with git-ssb-web