Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from blockstack/develop
Browse files Browse the repository at this point in the history
Version 0.6.0 Release
  • Loading branch information
hstove authored Apr 19, 2019
2 parents 0eeb149 + 02b25bd commit 1ceb327
Show file tree
Hide file tree
Showing 28 changed files with 512 additions and 114 deletions.
9 changes: 1 addition & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8.11.3
- image: circleci/node:10

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand All @@ -18,13 +18,6 @@ jobs:

steps:
- checkout
- run:
name: "Update npm"
command: |
npm install npm@latest
sudo rm -rf /usr/local/lib/node_modules/npm
sudo mv node_modules/npm /usr/local/lib/node_modules/npm
sudo chown -R 500:500 /usr/local/lib/node_modules/npm

# Download and cache dependencies
- restore_cache:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

# 0.6.0 - April 19, 2019

- Added a new Webpack-based generator. It's similar to the 'default' generator that uses browserify, but may result in smaller bundle sizes and an easier development environment.
- Updated React generator to use blockstack.js v19.1.0 and uses the new `UserSession` API.
- Updated the default generator to use blockstack.js v19.1.0 and uses the new `UserSession` API.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@ mkdir hello-blockstack && cd $_
yo blockstack
```

---

*For Webpack*

```bash
yo blockstack:webpack
```

---

*For React.JS*

```bash
yo blockstack:react
```

---

5) Start the development server:

```bash
Expand Down
4 changes: 4 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class BlockstackGenerator extends Generator {
this.templatePath('public/icon-192x192.png'),
this.destinationPath('public/icon-192x192.png')
)
this.fs.copy(
this.templatePath('public/favicon.ico'),
this.destinationPath('public/favicon.ico')
)
// html
this.fs.copy(
this.templatePath('public/index.html'),
Expand Down
8 changes: 4 additions & 4 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
"homepage": "https://github.com/blockstack/hello-blockstack#readme",
"devDependencies": {
"browserify": "^14.1.0",
"express": "^4.15.2",
"opn": "^4.0.2"
"browserify": "^16.2.3",
"express": "^4.16.4",
"open": "^6.1.0"
},
"dependencies": {
"blockstack": "^18.0.4"
"blockstack": "^19.1.0"
}
}
29 changes: 17 additions & 12 deletions app/templates/public/app.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById('signin-button').addEventListener('click', function(event) {
document.addEventListener("DOMContentLoaded", event => {
const appConfig = new blockstack.AppConfig()
const userSession = new blockstack.UserSession({ appConfig: appConfig })

document.getElementById('signin-button').addEventListener('click', event => {
event.preventDefault()
blockstack.redirectToSignIn()
userSession.redirectToSignIn()
})
document.getElementById('signout-button').addEventListener('click', function(event) {

document.getElementById('signout-button').addEventListener('click', event => {
event.preventDefault()
blockstack.signUserOut(window.location.href)
userSession.signUserOut()
window.location = window.location.origin
})

function showProfile(profile) {
var person = new blockstack.Person(profile)
function showProfile (profile) {
let person = new blockstack.Person(profile)
document.getElementById('heading-name').innerHTML = person.name() ? person.name() : "Nameless Person"
if(person.avatarUrl()) {
document.getElementById('avatar-image').setAttribute('src', person.avatarUrl())
Expand All @@ -18,11 +23,11 @@ document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById('section-2').style.display = 'block'
}

if (blockstack.isUserSignedIn()) {
var profile = blockstack.loadUserData().profile
showProfile(profile)
} else if (blockstack.isSignInPending()) {
blockstack.handlePendingSignIn().then(function(userData) {
if (userSession.isUserSignedIn()) {
const { profile } = userSession.loadUserData()
showProfile(profile)
} else if (userSession.isSignInPending()) {
userSession.handlePendingSignIn().then(userData => {
window.location = window.location.origin
})
}
Expand Down
Binary file added app/templates/public/favicon.ico
Binary file not shown.
44 changes: 24 additions & 20 deletions app/templates/public/index.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hello, Blockstack!</title>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" href="bootstrap.min.css" />
<link rel="stylesheet" href="app.css" />
<script src="bundle.js"></script>
<script src="app.js"></script>
</head>
<body>
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="panel-landing" id="section-1">
<h1 class="landing-heading">Hello, Blockstack!</h1>
<p class="lead">
<a href="#" class="btn btn-primary btn-lg" id="signin-button">
Sign In with Blockstack
</a>
</p>
</div>
<div class="panel-welcome hide" id="section-2">
<div class="avatar-section">
<img src="https://s3.amazonaws.com/onename/avatar-placeholder.png" class="img-rounded avatar" id="avatar-image">
<div class="site-wrapper-inner">
<div class="panel-landing" id="section-1">
<h1 class="landing-heading">Hello, Blockstack!</h1>
<p class="lead">
<a href="#" class="btn btn-primary btn-lg" id="signin-button">
Sign In with Blockstack
</a>
</p>
</div>
<div class="panel-welcome hide" id="section-2">
<div class="avatar-section">
<img src="https://s3.amazonaws.com/onename/avatar-placeholder.png" class="img-rounded avatar" id="avatar-image">
</div>
<h1>Hello, <span id="heading-name">Anonymous</span>!</h1>
<p class="lead">
<a href="#" class="btn btn-primary btn-lg" id="signout-button">
Logout
</a>
</p>
</div>
<h1>Hello, <span id="heading-name">Anonymous</span>!</h1>
<p class="lead">
<a href="#" class="btn btn-primary btn-lg" id="signout-button">
Logout
</a>
</p>
</div>
</div>
</div>
</body>
</html>
20 changes: 10 additions & 10 deletions app/templates/server.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const express = require('express')
const opn = require('opn')
const open = require('open')

const app = express()
const port = 5000

function allowCrossDomain(req, res, next) {
function allowCrossDomain (req, res, next) {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE')
res.header('Access-Control-Allow-Headers', 'Content-Type')
next()
}

app.use(allowCrossDomain)
app.use('/', express.static(__dirname + '/public'))
app.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(`server is listening on ${port}`)
opn(`http://localhost:${port}`)
})
app.use('/', express.static(`${__dirname}/public`))

app.listen(port, async (err) => {
if (err) { console.error('Something bad happend', err) }

console.log(`App running at: http://localhost:${port}`)
await open(`http://localhost:${port}`)
})
Loading

0 comments on commit 1ceb327

Please sign in to comment.