index.jsView |
---|
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | 438 | G.serveTemplate = function (req, title, code, read) { |
| 439 | + var self = this |
439 | 440 | if (read === undefined) |
440 | 441 | return this.serveTemplate.bind(this, req, title, code) |
441 | 442 | var q = req._u.query.q && u.escape(req._u.query.q) || '' |
442 | 443 | var app = 'git ssb' |
452 | 453 | '<link rel=stylesheet href="/static/styles.css"/>', |
453 | 454 | '<link rel=stylesheet href="/highlight/github.css"/>', |
454 | 455 | '</head>\n', |
455 | 456 | '<body>', |
456 | | - '<header><form action="/search" method="get">' + |
457 | | - '<h1><a href="/">' + app + '' + |
458 | | - (appName != 'ssb' ? ' <sub>' + appName + '</sub>' : '') + |
459 | | - '</a> ' + |
| 457 | + '<header>' |
| 458 | + ]), |
| 459 | + self.isPublic ? null : u.readOnce(function (cb) { |
| 460 | + self.about(self.myId, function (err, about) { |
| 461 | + if (err) return cb(err) |
| 462 | + cb(null, |
| 463 | + '<a href="' + u.encodeLink(this.myId) + '">' + |
| 464 | + (about.image ? |
| 465 | + '<img class="profile-icon icon-right"' + |
| 466 | + ' src="/' + encodeURIComponent(about.image) + '"' + |
| 467 | + ' alt="' + u.escape(about.name) + '">' : u.escape(about.name)) + |
| 468 | + '</a>') |
| 469 | + }) |
| 470 | + }), |
| 471 | + pull.once( |
| 472 | + '<form action="/search" method="get">' + |
| 473 | + '<h1><a href="/">' + app + |
| 474 | + (appName == 'ssb' ? '' : ' <sub>' + appName + '</sub>') + |
| 475 | + '</a></h1> ' + |
460 | 476 | '<input class="search-bar" name="q" size="60"' + |
461 | 477 | ' placeholder="๐" value="' + q + '" />' + |
462 | | - '</h1>', |
463 | | - '</form></header>', |
464 | | - '<article>']), |
| 478 | + '</form>' + |
| 479 | + '</header>' + |
| 480 | + '<article>'), |
465 | 481 | this.renderTry(read), |
466 | 482 | pull.once('<hr/></article></body></html>') |
467 | 483 | ]) |
468 | 484 | } |