From 418b0b22b6e75f5ae70e0654bc30ef878b50ee1a Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Tue, 22 Oct 2019 11:41:23 -0700 Subject: [PATCH 1/5] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ad4399d..7c577cb2 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,8 @@ Thanks to:
Alan Mimms, Dário Freire, John Williamson, -Robin Bron +Robin Bron, +Elie Makhoul

- Join others in sponsoring code: https://www.patreon.com/gunDB ! From 76a52314980c7b8eebc0d3bfa4e46e58b21f7150 Mon Sep 17 00:00:00 2001 From: BillyNate Date: Tue, 22 Oct 2019 13:54:42 +0200 Subject: [PATCH 2/5] Fixed an error on Windows 10 in multicasting Fixes #787 --- lib/multicast.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/multicast.js b/lib/multicast.js index 75ebb9a0..94f0e39b 100644 --- a/lib/multicast.js +++ b/lib/multicast.js @@ -19,7 +19,11 @@ Gun.on('create', function(root){ try{ dgram = require("dgram") }catch(e){ return } var socket = dgram.createSocket({type: "udp4", reuseAddr: true}); - socket.bind(udp.port); + socket.bind({port: udp.port, exclusive: true}, function(){ + socket.setBroadcast(true); + socket.setMulticastTTL(128); + socket.addMembership(udp.address); + }); socket.on("listening", function(){ try { socket.addMembership(udp.address) }catch(e){ return } From 0050eeb89acf58b130213c6754f94f2f19583f56 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 25 Oct 2019 23:11:09 +0200 Subject: [PATCH 3/5] Added Unebo to the 'deploy' section of the readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7c577cb2..984120fc 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,13 @@ now --npm amark/gun Then visit the URL in the output of the 'now --npm' step, in your browser. +### [Unebo](https://unubo.app/) + +Fork this GUN repo (Unebo only deploys from your own GitHub repo's). +Add a Node.js app, select your GUN fork, set `npm start` start as the command and deploy. + +Then visit the deployed app by following the 'view app' button, in your browser. + ### [Docker](https://www.docker.com/) [![Docker Automated buil](https://img.shields.io/docker/automated/gundb/gun.svg)](https://hub.docker.com/r/gundb/gun/) [![](https://images.microbadger.com/badges/image/gundb/gun.svg)](https://microbadger.com/images/gundb/gun "Get your own image badge on microbadger.com") [![Docker Pulls](https://img.shields.io/docker/pulls/gundb/gun.svg)](https://hub.docker.com/r/gundb/gun/) [![Docker Stars](https://img.shields.io/docker/stars/gundb/gun.svg)](https://hub.docker.com/r/gundb/gun/) From e92bf7b94024cd4714aa0aecd4d7945bc5153f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jussi=20Rytk=C3=B6nen?= Date: Tue, 29 Oct 2019 01:32:55 +0200 Subject: [PATCH 4/5] modularizes meta.js --- .gitignore | 1 + lib/meta.js | 78 +++++++++++++++++++++++++++++++++------------------- package.json | 3 +- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index c3a119dc..63079ba6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ yarn.lock .esm-cache .sessionStorage .localStorage +lib/meta \ No newline at end of file diff --git a/lib/meta.js b/lib/meta.js index c9fa3f9b..4b412a5c 100644 --- a/lib/meta.js +++ b/lib/meta.js @@ -1,5 +1,18 @@ ;(function(){ + function USE(arg, req){ + return req? require(arg) : arg.slice? USE[R(arg)] : function(mod, path){ + arg(mod = {exports: {}}); + USE[R(path)] = mod.exports; + } + function R(p){ + return p.split('/').slice(-1).toString().replace('.js',''); + } + } + +/* UNBUILD */ +;USE(function(module){ var noop = function(){}, u; + $.fn.or = function(s){ return this.length ? this : $(s||'body') }; var m = window.meta = {edit:[]}; var k = m.key = {}; k.meta = {17:17, 91:17, 93:17, 224:17}; @@ -34,7 +47,7 @@ } m.flip = function(tmp){ var board = $('#meta .meta-menu'); - ((tmp === false) || (!tmp && board.is(':visible')))? + ((tmp === false) || (!tmp && board.is(':visible')))? board.addClass('meta-none') : board.removeClass('meta-none'); } @@ -89,7 +102,7 @@ m.ask = function(help, cb){ var $ul = $('#meta .meta-menu ul').empty(); var $put = $('').attr('id', 'meta-ask').attr('placeholder', help); - var $form = $('
').append($put).on('submit', function(eve){ + var $form = $('').append($put).on('submit', function(eve){ eve.preventDefault(); cb($put.val()); $li.remove(); @@ -112,27 +125,6 @@ .or($(document.elementFromPoint(meta.tap.x, meta.tap.y))); return on; } - $(window).on('blur', k.wipe).on('focus', k.wipe); - $(document).on('mousedown mousemove mouseup', function(eve){ - m.tap.eve = eve; - m.tap.x = eve.pageX||0; - m.tap.y = eve.pageY||0; - m.tap.on = $(eve.target); - }).on('mousedown touchstart', function(eve){ - var tmp = m.tap.edit; - if(!tmp || !tmp.on){ return } - tmp.on(eve); - m.tap.edit = null; - }); - $(document).on('touchstart', '#meta .meta-start', function(eve){ m.tap.stun = true }); - $(document).on('click', '#meta .meta-menu li', function(eve){ - if(m.tap.stun){ return m.tap.stun = false } - if(!(eve.fake = eve.which = (($(this).text().match(/[A-Z]/)||{})[0]||'').toUpperCase().charCodeAt(0))){ return } - eve.tap = true; - k.down(eve); - k.up(eve); - }); - $(document).on('keydown', k.down).on('keyup', k.up); meta.edit = function(edit){ var tmp = edit.combow = []; $.each(edit.combo || (edit.combo = []), function(i,k){ @@ -144,8 +136,9 @@ edit.combow = edit.combow.join(','); m.list(meta.edit); } - $.fn.or = function(s){ return this.length ? this : $(s||'body') }; - ;(function(){try{ +})(USE, './metaCore'); + + ;USE(function(module){try{ /* UI */ if(meta.css){ return } var $m = $('
').attr('id', 'meta'); @@ -235,8 +228,9 @@ tag.innerHTML = tmp; document.body.appendChild(tag); } - }catch(e){}}()); - ;(function(){ + }catch(e){}})(USE, './metaUI'); + + ;USE(function(module){ // include basic text editing by default. var monotype = window.monotype || function(){console.log("monotype needed")}; var m = meta; @@ -256,7 +250,6 @@ return ((tmp = window.getSelection) && tmp().toString()) || ((tmp = document.selection) && tmp.createRange().text) || ''; } - $(document).on('select contextmenu keyup mouseup', '[contenteditable=true]', m.text.on); m.text.editor = function(opt, as){ var tmp; if(!opt){ return } opt = (typeof opt == 'string')? {edit: opt} : opt.tag? opt : {tag: opt}; @@ -379,5 +372,32 @@ on: function(eve){ meta.text.editor('fontSize', 7) }, up: function(){} }); - }()); + })(USE, './metaText'); + + + ;USE(function(module){ + $(window).on('blur', k.wipe).on('focus', k.wipe); + $(document).on('mousedown mousemove mouseup', function(eve){ + m.tap.eve = eve; + m.tap.x = eve.pageX||0; + m.tap.y = eve.pageY||0; + m.tap.on = $(eve.target); + }).on('mousedown touchstart', function(eve){ + var tmp = m.tap.edit; + if(!tmp || !tmp.on){ return } + tmp.on(eve); + m.tap.edit = null; + }); + $(document).on('touchstart', '#meta .meta-start', function(eve){ m.tap.stun = true }); + $(document).on('click', '#meta .meta-menu li', function(eve){ + if(m.tap.stun){ return m.tap.stun = false } + if(!(eve.fake = eve.which = (($(this).text().match(/[A-Z]/)||{})[0]||'').toUpperCase().charCodeAt(0))){ return } + eve.tap = true; + k.down(eve); + k.up(eve); + }); + $(document).on('keydown', k.down).on('keyup', k.up); + $(document).on('select contextmenu keyup mouseup', '[contenteditable=true]', m.text.on); + })(USE, './metaEvents'); + }()); \ No newline at end of file diff --git a/package.json b/package.json index 53f7ba31..91333807 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "e2e": "mocha e2e/distributed.js", "docker": "hooks/build", "minify": "uglifyjs gun.js -o gun.min.js -c -m", - "unbuild": "node lib/unbuild.js & npm run minify" + "unbuild": "node lib/unbuild.js & npm run minify", + "unbuildMeta": "node lib/unbuild.js lib/meta" }, "repository": { "type": "git", From 42926ec09df8c3097da4b2e84715102fda7ead11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jussi=20Rytk=C3=B6nen?= Date: Mon, 4 Nov 2019 22:28:23 +0200 Subject: [PATCH 5/5] meta/edit removed from gitignore --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 63079ba6..74fb92eb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,4 @@ yarn.lock *.DS_store .esm-cache .sessionStorage -.localStorage -lib/meta \ No newline at end of file +.localStorage \ No newline at end of file