gitmark 0.0.40 → 0.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/git-mark CHANGED
@@ -18,7 +18,8 @@ globalThis.data = {
18
18
  privkey: '132e7465a63e30a74c5b0deae3573033319e9de18a84878613eaa21878b2b56b',
19
19
  hash: 'b3e8f5735849af7f18a13ead08532043a7f82153',
20
20
  genesis: null,
21
- branch: 'gh-pages'
21
+ branch: 'gh-pages',
22
+ notify: 'http://gitmark.me:4444'
22
23
  }
23
24
 
24
25
  // FUNCTIONS
@@ -106,7 +107,7 @@ data.genesis = argv.genesis || data.genesis
106
107
  console.log('data', data)
107
108
 
108
109
  var lastCommit = commits.filter(i => {
109
- return i.subject.match(/^gitmark/)
110
+ return i.subject.match(/^gitmark[ :][A-Fa-f0-9]/)
110
111
  })
111
112
  if (lastCommit && lastCommit[0] && lastCommit[0].subject) {
112
113
  lastCommit = lastCommit[0].subject
@@ -280,5 +281,9 @@ if (txexe && argv.send) {
280
281
  console.log('committing')
281
282
  $('git commit --allow-empty -m' + ' "gitmark ' + newtx.toString() + '"')
282
283
  $(`git push origin ${data.branch}`)
284
+
285
+ if (argv.notify) {
286
+ $(`./bin/notify.js gitmark:${newtx}:0`)
287
+ }
283
288
  }
284
289
  }
package/bin/git-mark-init CHANGED
@@ -139,6 +139,14 @@ console.log('tx', tx)
139
139
 
140
140
  // create gitmark.json
141
141
  console.log('create gitmark.json and check in files')
142
+ console.log(`{
143
+ "@id": "gitmark:${tx}:1",
144
+ "genesis": "gitmark:${tx}:1",
145
+ "nick": "gitmark",
146
+ "package": "./package.json",
147
+ "repository": "./"
148
+ }`)
149
+
142
150
 
143
151
  // git mark genesis
144
152
  console.log('git mark --genesis ', tx)
@@ -38,7 +38,7 @@ const options = {
38
38
  fields: ['hash', 'subject']
39
39
  }
40
40
 
41
- function getPrivKey () {
41
+ function getPrivKey() {
42
42
  try {
43
43
  const fetchHeadDir = './.git/'
44
44
  var fetchHeadFile = fetchHeadDir + 'FETCH_HEAD'
@@ -82,9 +82,9 @@ if (commits.length === 1) {
82
82
  }
83
83
 
84
84
  console.log('Genesis tx need not be verified\n')
85
- for (var i = commits.length-1; i >= 0; i--) {
85
+ for (var i = commits.length - 1; i >= 0; i--) {
86
86
  var subject = commits[i].subject
87
- if (subject.match(/^gitmark/)) {
87
+ if (subject.match(/^gitmark[: ][A-Fa-f0-9]/)) {
88
88
  var hash = commits[i + 1].hash
89
89
  console.log()
90
90
  console.log(subject)
@@ -106,8 +106,8 @@ for (var i = commits.length-1; i >= 0; i--) {
106
106
 
107
107
  console.log(
108
108
  'https://chainz.cryptoid.info/marks/tx.dws?' +
109
- subject.split(' ')[1].split(':')[0] +
110
- '.htm'
109
+ subject.split(' ')[1].split(':')[0] +
110
+ '.htm'
111
111
  )
112
112
  }
113
113
  }
package/bin/notify.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ var WebSocket = require('ws');
4
+
5
+ var secret = process.env['SECRET'] || 's'
6
+
7
+ var uri = process.argv[3] || 'ws://localhost:4444'
8
+
9
+ const ws = new WebSocket(uri)
10
+
11
+ ws.on('open', function open() {
12
+ ws.send(`update ${process.argv[2] || 'a'} ${secret}`)
13
+ ws.close()
14
+ })
15
+
16
+ ws.on('message', function incoming(message) {
17
+ console.log('received: %s', message);
18
+ });
19
+
20
+
package/gitmark.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "@id": "gitmark:59ff24db0321cb6b32a404815345b00ae68ca8b81150fbea6464ee10557e0fae:1",
3
+ "genesis": "gitmark:59ff24db0321cb6b32a404815345b00ae68ca8b81150fbea6464ee10557e0fae:1",
4
+ "nick": "gitmark",
5
+ "package": "./package.json",
6
+ "repository": "./"
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmark",
3
- "version": "0.0.40",
3
+ "version": "0.0.46",
4
4
  "description": "gitmark",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,6 +29,7 @@
29
29
  "fs": "^0.0.1-security",
30
30
  "gitlog": "^4.0.4",
31
31
  "minimist": "^1.2.5",
32
- "tiny-secp256k1": "^1.1.6"
32
+ "tiny-secp256k1": "^1.1.6",
33
+ "ws": "^8.2.3"
33
34
  }
34
35
  }