- 🍠My blog built with Gatsby. Neat.
+ 🍠My blog built with Gatsby + TypeScript. Neat.
kremalicious.com
diff --git a/jest.config.js b/jest.config.js
index d84fce0a..884f8d28 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -3,12 +3,12 @@ module.exports = {
'^.+\\.(tsx?|jsx?)$': 'ts-jest',
'^.+\\.jsx?$': '/jest/jest-preprocess.js'
},
- testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$',
+ testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.([tj]sx?)$',
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
- '/jest/__mocks__/file-mock.ts',
- '\\.svg': '/jest/__mocks__/svgr-mock.ts'
+ '/jest/__mocks__/file-mock.js',
+ '\\.svg': '/jest/__mocks__/svgr-mock.js'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testPathIgnorePatterns: ['node_modules', '.cache', 'public', 'coverage'],
@@ -16,7 +16,6 @@ module.exports = {
globals: {
__PATH_PREFIX__: ''
},
- testURL: 'http://localhost',
setupFiles: ['/jest/loadershim.js'],
setupFilesAfterEnv: ['/jest/setup-test-env.ts'],
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/@types/**/*']
diff --git a/jest/__fixtures__/avatar.json b/jest/__fixtures__/avatar.json
index f540fd70..dfd08cc5 100644
--- a/jest/__fixtures__/avatar.json
+++ b/jest/__fixtures__/avatar.json
@@ -1,20 +1,22 @@
{
- "edges": [
- {
- "node": {
- "childImageSharp": {
- "fixed": {
- "aspectRatio": 1,
- "width": 80,
- "height": 80,
- "src": "/static/b61a09d5f4cbd9d8b2844091590ddea4/fce1d/avatar.jpg",
- "srcSet": "/static/b61a09d5f4cbd9d8b2844091590ddea4/fce1d/avatar.jpg 1x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/c4de8/avatar.jpg 1.5x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/c3234/avatar.jpg 2x",
- "srcWebp": "/static/b61a09d5f4cbd9d8b2844091590ddea4/ad6b8/avatar.webp",
- "srcSetWebp": "/static/b61a09d5f4cbd9d8b2844091590ddea4/ad6b8/avatar.webp 1x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/5c322/avatar.webp 1.5x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/5bf6b/avatar.webp 2x",
- "originalName": "avatar.jpg"
+ "avatar": {
+ "edges": [
+ {
+ "node": {
+ "childImageSharp": {
+ "fixed": {
+ "aspectRatio": 1,
+ "width": 80,
+ "height": 80,
+ "src": "/static/b61a09d5f4cbd9d8b2844091590ddea4/fce1d/avatar.jpg",
+ "srcSet": "/static/b61a09d5f4cbd9d8b2844091590ddea4/fce1d/avatar.jpg 1x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/c4de8/avatar.jpg 1.5x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/c3234/avatar.jpg 2x",
+ "srcWebp": "/static/b61a09d5f4cbd9d8b2844091590ddea4/ad6b8/avatar.webp",
+ "srcSetWebp": "/static/b61a09d5f4cbd9d8b2844091590ddea4/ad6b8/avatar.webp 1x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/5c322/avatar.webp 1.5x,\n/static/b61a09d5f4cbd9d8b2844091590ddea4/5bf6b/avatar.webp 2x",
+ "originalName": "avatar.jpg"
+ }
}
}
}
- }
- ]
+ ]
+ }
}
diff --git a/jest/__fixtures__/github.json b/jest/__fixtures__/github.json
new file mode 100644
index 00000000..b29585d4
--- /dev/null
+++ b/jest/__fixtures__/github.json
@@ -0,0 +1,219 @@
+{
+ "github": {
+ "viewer": {
+ "repositories": {
+ "edges": [
+ {
+ "node": {
+ "name": "csspaperstack",
+ "url": "https://github.com/kremalicious/csspaperstack",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "hastuzeit",
+ "url": "https://github.com/kremalicious/hastuzeit",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "Badged",
+ "url": "https://github.com/kremalicious/Badged",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "hsresponsive",
+ "url": "https://github.com/kremalicious/hsresponsive",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "dribbble-chromeapp",
+ "url": "https://github.com/kremalicious/dribbble-chromeapp",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "krtmn",
+ "url": "https://github.com/kremalicious/krtmn",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": {
+ "id": "MDQ6QmxvYjM2MzA0MzQ6NDcwYWRiOTc5MWVjYzZkNmU0YzMzNDQ3ZmZhZjBhNjA0ZGE1NTBkNA==",
+ "text": "YOURLS Changelog\n================\n\n_This file lists the main changes through all versions of YOURLS. \nFor a much more detailed list, simply refer to [commit messages](https://github.com/YOURLS/YOURLS/commits/master)._\n\n1.7\n---\n- added: support for PDO and MySQLi\n- added: social bookmarklets - share on Twitter, Facebook or Tumblr in a click\n- added: check api.yourls.org if a new version of YOURLS is available\n- added: proxy support - install YOURLS behind a firewall!\n- improved: security regarding SQL injections\n- improved: security regarding your credentials - now auto-encrypted\n- improved: external HTTP request handling\n- improved: ƒυηкƴ UTF-8 titles handling\n- fixed: compatibility with Apache mod_security blocking bookmarklets\n- fixed: lots of bugs\n\n1.6\n---\n- added: مرŘبا العالم! Hej verden! ä˝ ĺĄ˝ä¸–ç•Ś! Kumusta mundo! Ciao mondo! Hello world! Translation API.\n- added: custom API actions\n- added: support for URLs with common protocols\n- fixed: search and pagination in the admin interface\n- updated: third party libs jQuery, ezSQL, GeoIP\n- improved: sanitizing and escaping functions\n\n1.5.1\n-----\n- added: full jsonp support\n- added: ability to use encrypted passwords in the config file\n- fixed: support for http://www.sho.rt/bleh and http://sho.rt/bleh\n- added: support for any favicon dropped in the /user directory\n- updated: Google Visualization API instead of deprecated Google Charts\n- fixed: bugs, bugs, bugs\n- added: hooks, hooks, hooks\n- improved: things, things, things\n\n1.5\n---\n- added: plugin architecture! OMG plugins!!1!!1!\n- added: directory /user, config.php can be moved there\n- added: new \"instant bookmarklets\"\n- added: 1 click copy-to-clipboard a la bitly\n- change in logic: now all request are handled by PHP and don't rely on .htaccess\n- added: saving URL titles\n- added: support for prefix-n-shorten: sho.rt/http://example.com/\n- added: core plugin to allow hyphens in URLs\n- added: core sample plugin to wrap redirected URLs in a social toolbar\n- added: core sample plugin to show how to create administration page in plugins\n- added: core plugin to display a random pretty background\n- changed: layout now using a more consistent palette, see http://yourls.org/palette\n- added: anti XSS and anti CSRF measures\n- added: interactive map if possible in stat traffic by countries\n- fixed: lots of bugs\n\n1.4.3\n-----\n- fixed bug no-stats-showing-ffs due to inconsistency in DB schema\n- improve error reporting with API method url-stat\n\n1.4.2\n-----\n- fixed: bug in auth function\n- added: sample public API file\n- added: check in API requests for WordPress plugin when adding a new short URL\n- prettier sample public interface\n\n1.4.1\n-----\n- fixed: base 62 URLs (keywords with MiXeD CaSe)\n- new & secure auth method for API calls, with no need to use login & password combo\n- allow SSL enforcement for admin pages\n- new API method: stats for individual URL.\n- prevent internal redirection loops\n- filter and search URLs & short URLs by date\n\n1.4\n---\n- added: an upgrader from 1.3 to 1.4\n- change in logic: now using a global object $ydb for everything related to DB and other globally needed stuff\n- change in logic: include \"load-yourls.php\" instead of \"config.php\" to start engine\n- change in DB schema: now storing URLs with their keyword as used in shorturl, allowing for any keyword length\n- change in DB schema: new table for storing various options including next_id, dropping table of the same name\n- change in DB schema: new table for storing hits (for stats)\n- improved the installer, with .htaccess file creation\n- layout tweak: now prettier, isn't it?\n- stats! OMG stats!\n\n1.3-RC1\n-------\n- added bookmarklet and tools page\n- improved XSS filter when adding new URL\n- code cleanup in admin/index.php to separate code and display\n- added favicon\n- stricter coding to prevent notices with undefined indexes\n- hide PHP notices & SQL errors & warnings, unless YOURLS_DEBUG constant set to true\n\n1.2\n---\n- don't remember. A few tiny stuff for sure.\n\n1.1\n---\n- don't remember. Some little bugs I guess.\n\n1.0.1\n-----\n- don't remember. Trivial stuff probably.\n\n1.0\n---\n- initial release\n"
+ }
+ }
+ },
+ {
+ "node": {
+ "name": "glassfruit",
+ "url": "https://github.com/kremalicious/glassfruit",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "kremalicious2",
+ "url": "https://github.com/kremalicious/kremalicious2",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "wp-icons-template",
+ "url": "https://github.com/kremalicious/wp-icons-template",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "kbdfun",
+ "url": "https://github.com/kremalicious/kbdfun",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "dotfiles",
+ "url": "https://github.com/kremalicious/dotfiles",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "kretschmann.io",
+ "url": "https://github.com/kremalicious/kretschmann.io",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "blog",
+ "url": "https://github.com/kremalicious/blog",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "files",
+ "url": "https://github.com/kremalicious/files",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "appstorebadges",
+ "url": "https://github.com/kremalicious/appstorebadges",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "hyper-mac-pro",
+ "url": "https://github.com/kremalicious/hyper-mac-pro",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "ipfs-hosting",
+ "url": "https://github.com/kremalicious/ipfs-hosting",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "gatsby-plugin-matomo",
+ "url": "https://github.com/kremalicious/gatsby-plugin-matomo",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": {
+ "id": "MDQ6QmxvYjEzMjQ5NDg4NTozNzMwOWUxMTc4MTA5YjJmZDQ3ZDg5YTZlZjIwNjM5NTNlNDNlZjA1",
+ "text": "### Changelog\n\nAll notable changes to this project will be documented in this file. Dates are displayed in UTC.\n\nGenerated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).\n\n#### [v0.7.2](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.7.1...v0.7.2)\n\n> 13 June 2019\n\n- Fix missing tracking code in rendered HTML [`#18`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/18)\n- update changelog [`57092e5`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/57092e5b0f755867885d4877ba539e2e684eba3c)\n- Release 0.7.2 [`31cabd6`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/31cabd60afbf9da39bce3cbd9187ba203c8f6e93)\n\n#### [v0.7.1](https://github.com/kremalicious/gatsby-plugin-matomo/compare/0.7.0...v0.7.1)\n\n> 10 June 2019\n\n- preconnect to configured Matomo host url [`#17`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/17)\n- Add prettier [`#16`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/16)\n- add prettier [`858fc2e`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/858fc2eb8a58dc49cfe1fea77d2b71c7d2ac4888)\n- new release-it setup [`bbb5f19`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/bbb5f19f94b867b7f7f6959a201690c290ac0fe2)\n- bump packages [`e3479f6`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/e3479f6955f6324140e7243b0f680dd3771250f7)\n\n#### [0.7.0](https://github.com/kremalicious/gatsby-plugin-matomo/compare/0.6.1...0.7.0)\n\n> 30 March 2019\n\n- Page tracking improvements [`#15`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/15)\n- capture and send custom page title [`#11`](https://github.com/kremalicious/gatsby-plugin-matomo/issues/11)\n- better page url & referrer url tracking [`04b8ba1`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/04b8ba19038f49571a0f19099f9af4575739a8fb)\n- update changelog [`24f57da`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/24f57da352ee95781ed2c4268f31adaaa5aa1d82)\n- Release 0.7.0 [`4c36d9c`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/4c36d9c7c6212542fc1b3ebba977ee9c1e9bc526)\n\n#### [0.6.1](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.6.0...0.6.1)\n\n> 30 March 2019\n\n- package updates [`#14`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/14)\n- Update release-it to the latest version 🚀 [`#12`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/12)\n- Update release-it to the latest version 🚀 [`#10`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/10)\n- run changelog before release [`5da11a4`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/5da11a47609f48328d544bab07600576c6f060e0)\n- Release 0.6.1 [`f62c5bf`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/f62c5bf2926726bfc649d24b7fd555974c10482f)\n- chore(package): update release-it to version 10.0.0 [`d56c6c3`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/d56c6c3dba6607f5d67bf70a0953a8d922d84298)\n\n#### [v0.6.0](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.5.1...v0.6.0)\n\n> 5 December 2018\n\n- Path exclusion [`#9`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/9)\n- add changelog [`2b268a1`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/2b268a1c6c0df2b4e344c1f965a665e7be8d9341)\n- allow exclusion of paths [`9464d47`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/9464d47ae1b191ef494148fab4af200e3ea9c85c)\n- make release-it work with conventional-changelog [`2dcd5a7`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/2dcd5a7d02a2c35b95ddbec44d2319b0b25dc682)\n\n#### [v0.5.1](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.5.0...v0.5.1)\n\n> 21 November 2018\n\n- Update release-it to the latest version 🚀 [`#8`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/8)\n- bump packages [`cb26a40`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/cb26a40ece69e756862c5b6986eed60acca61bdd)\n- new Matomo logo [`64dd425`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/64dd4259ecda1fba49ac2bbfba7727bd5a544e3c)\n- Release 0.5.1 [`c442282`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/c44228275734a5edcf790a0bd8c91b9eec634891)\n\n#### [v0.5.0](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.4.1...v0.5.0)\n\n> 6 August 2018\n\n- Add consent mode [`#7`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/7)\n- Scoping js variables to avoid polluting global scope [`#6`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/6)\n- bump packages [`b08b4a5`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/b08b4a5a45c477898b53831e48109bd672e3e11d)\n- add codeclimate config [`a96e8ea`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/a96e8ea5f89fdc07f84bdd49b927c5c757cf4665)\n- Add disableCookies option [`ff9a2c7`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/ff9a2c755867e60964953c109ab382915b662279)\n\n#### [v0.4.1](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.4.0...v0.4.1)\n\n> 28 June 2018\n\n- Update eslint to the latest version 🚀 [`#5`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/5)\n- improvements for SPA tracking [`7d653d5`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/7d653d564cb0ca4ae05d6897d94185ea2198462e)\n- package updates [`347f951`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/347f951174ec6b9f31b91cbd7bce90178eb49a1a)\n- Release 0.4.1 [`b254c13`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/b254c130b9ee8c750e2dd3f69540537094eac235)\n\n#### [v0.4.0](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.3.2...v0.4.0)\n\n> 19 June 2018\n\n- Updates for Gatsby v2 [`#4`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/4)\n- updates for Gatsby v2 [`59e442a`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/59e442a31d85af27f8cdf65a2d15ed8601995fad)\n- package updates [`356e68f`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/356e68faf500baf4c69461fa8323995f30400e24)\n- Release 0.4.0 [`1173236`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/117323688af1963ca5602b13ddd6131aba70376c)\n\n#### [v0.3.2](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.3.1...v0.3.2)\n\n> 23 May 2018\n\n- save some lines [`5034a3b`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/5034a3b8e5201d976f7deb210b471caa50ea16cd)\n- Release 0.3.2 [`c531e47`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/c531e47cf5905acda149a637606ecfea9e2e40bc)\n- change repository field [`260273e`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/260273e0139db6d5bf76bc29c37d2f93fd254f05)\n\n#### [v0.3.1](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.3.0...v0.3.1)\n\n> 14 May 2018\n\n- package updates [`2acbd45`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/2acbd450cb7dffe39c3cb57edbad5aeebe6d7799)\n- Release 0.3.1 [`f9050ce`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/f9050ceaa2b8d214d113ca78785bb7ba78f14d5a)\n- fix environment check [`dc574ab`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/dc574ab72c4ec01c4fa995ae9aa9a1469f04387a)\n\n#### [v0.3.0](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.2.0...v0.3.0)\n\n> 10 May 2018\n\n- allow local piwik.js path to be set [`a15146c`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/a15146c3dc6b692070e09b38646ad925fc92fb28)\n- Release 0.3.0 [`2e36f13`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/2e36f1383d39703d10405b9e82782a6efa54d56f)\n\n#### [v0.2.0](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.1.3...v0.2.0)\n\n> 8 May 2018\n\n- add dev mode [`5c05efe`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/5c05efe1815fb617e0153924696dc6350e2e753c)\n- Release 0.2.0 [`a3ef6d4`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/a3ef6d4c635a15d6cc64c7c3735f551737f3eff7)\n\n#### [v0.1.3](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.1.2...v0.1.3)\n\n> 8 May 2018\n\n- readme updates [`49640f4`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/49640f4d37b54728c5a80ae9f2c63cb103318386)\n- Release 0.1.3 [`0109e19`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/0109e19e106f8620056db2775205101bf4cc1c3b)\n\n#### [v0.1.2](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.1.1...v0.1.2)\n\n> 8 May 2018\n\n- Add Greenkeeper badge 🌴 [`#1`](https://github.com/kremalicious/gatsby-plugin-matomo/pull/1)\n- do nothing on route updates when piwik isn't loaded and in development [`6c0a840`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/6c0a840de21ce46f544b6ce9a7dd63e961e7ab6b)\n- move greenskeeper badge [`b361eef`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/b361eef43bc85c7acf8be73f3067686912ac49b3)\n- Release 0.1.2 [`370025f`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/370025f1ee733d8f87a70def3bf213e52a1125fa)\n\n#### [v0.1.1](https://github.com/kremalicious/gatsby-plugin-matomo/compare/v0.1.0...v0.1.1)\n\n> 7 May 2018\n\n- link up readme badges [`6793592`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/6793592ed28e23177ad0450874ebba055d912dc2)\n- Release 0.1.1 [`48c73ff`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/48c73ff2415dd25ce85924cdd53056b8f561face)\n- docs(readme): add Greenkeeper badge [`ec73329`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/ec73329dd2ad383aa380ed57667da7a7019824a1)\n\n#### v0.1.0\n\n> 7 May 2018\n\n- initial commit 🍹 [`49bffd3`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/49bffd3cf18f1ba9e099048f9a5591f9200f3296)\n- add Travis, add badges, add semi-auto releases [`fe823b7`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/fe823b76a18a5310e3cd19965b9f61e02774f7e0)\n- Release 0.1.0 [`09739a7`](https://github.com/kremalicious/gatsby-plugin-matomo/commit/09739a72c5c2e08b0a74faba8bc4cfb03fdac220)\n"
+ }
+ }
+ },
+ {
+ "node": {
+ "name": "portfolio",
+ "url": "https://github.com/kremalicious/portfolio",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": null
+ }
+ },
+ {
+ "node": {
+ "name": "gatsby-redirect-from",
+ "url": "https://github.com/kremalicious/gatsby-redirect-from",
+ "owner": {
+ "login": "kremalicious"
+ },
+ "object": {
+ "id": "MDQ6QmxvYjE0NjY2ODk3NDo1YmVmMzg0N2ZlZThjMTk3NThiYThmMjBiMzE3NDFmN2I0YTcwZGU4",
+ "text": "### Changelog\n\nAll notable changes to this project will be documented in this file. Dates are displayed in UTC.\n\nGenerated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).\n\n#### [v0.2.1](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.2.0...v0.2.1)\n\n> 10 June 2019\n\n- fix auto changelog [`bba9f39`](https://github.com/kremalicious/gatsby-redirect-from/commit/bba9f3915511193384863b61b28b3c7f36d1007f)\n\n#### [v0.2.0](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.1.1...v0.2.0)\n\n> 10 June 2019\n\n- Update docs & dependencies [`#12`](https://github.com/kremalicious/gatsby-redirect-from/pull/12)\n- specify node 8 instead of 10 as engine [`#11`](https://github.com/kremalicious/gatsby-redirect-from/pull/11)\n- Support alternative markdown queries (such as allMdx) [`#10`](https://github.com/kremalicious/gatsby-redirect-from/pull/10)\n- Update release-it to the latest version 🚀 [`#8`](https://github.com/kremalicious/gatsby-redirect-from/pull/8)\n- update docs, mention new options [`07835d8`](https://github.com/kremalicious/gatsby-redirect-from/commit/07835d8405854a4e5a190a6eeeb252604aaaddb7)\n- simplify release-it tasks, add changelog [`3ec4ccf`](https://github.com/kremalicious/gatsby-redirect-from/commit/3ec4ccfb8e19032068fd34c24929179a5237f0ca)\n- add prettier [`3f33f65`](https://github.com/kremalicious/gatsby-redirect-from/commit/3f33f65430126e634f498629e6be8437c6f1ed7b)\n\n#### [v0.1.1](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.1.0...v0.1.1)\n\n> 30 August 2018\n\n- integrate with gatsby-plugin-meta-redirect, notes on server rendering [`2cd07ee`](https://github.com/kremalicious/gatsby-redirect-from/commit/2cd07ee33e2c267b3783630c6e5cfbdb6fb57c4b)\n- Release 0.1.1 [`e72d5ab`](https://github.com/kremalicious/gatsby-redirect-from/commit/e72d5aba5474104d34c99fcc5880a39c02696918)\n\n#### [v0.1.0](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.0.3...v0.1.0)\n\n> 30 August 2018\n\n- babelify build [`#5`](https://github.com/kremalicious/gatsby-redirect-from/pull/5)\n- clarify prerequisites [`139a4af`](https://github.com/kremalicious/gatsby-redirect-from/commit/139a4afc1d81fee444a6bf0c4775c63aea4e7c09)\n- Release 0.1.0 [`9bd28a7`](https://github.com/kremalicious/gatsby-redirect-from/commit/9bd28a7e9cc3cfa83e3b5b7606b08d3cb26fafe0)\n- add npm badge [`53043c8`](https://github.com/kremalicious/gatsby-redirect-from/commit/53043c82f86dfd2e17c1ca0ec4580441baeb6d8d)\n\n#### [v0.0.3](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.0.2...v0.0.3)\n\n> 29 August 2018\n\n- fix publish [`c91a362`](https://github.com/kremalicious/gatsby-redirect-from/commit/c91a3626390bfa632322007300818e58a25d75d0)\n- Release 0.0.3 [`f1d4982`](https://github.com/kremalicious/gatsby-redirect-from/commit/f1d4982d2424beb67119702a8181d4284ffe399e)\n\n#### v0.0.2\n\n> 29 August 2018\n\n- Add Greenkeeper badge 🌴 [`#1`](https://github.com/kremalicious/gatsby-redirect-from/pull/1)\n- initial commit 🍷 [`dfb3bb0`](https://github.com/kremalicious/gatsby-redirect-from/commit/dfb3bb0954b1933c4d9e36ebc8cb302a0dc70795)\n- Release 0.0.2 [`6924e7b`](https://github.com/kremalicious/gatsby-redirect-from/commit/6924e7b2d9d00a6eb6a03eeb328f29d561dbf904)\n- fix test [`b0129a5`](https://github.com/kremalicious/gatsby-redirect-from/commit/b0129a5ee73d292422a2f7746412aa55a0ce1097)\n"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+}
diff --git a/jest/__fixtures__/meta.json b/jest/__fixtures__/meta.json
new file mode 100644
index 00000000..e8b54831
--- /dev/null
+++ b/jest/__fixtures__/meta.json
@@ -0,0 +1,39 @@
+{
+ "site": {
+ "siteMetadata": {
+ "siteTitle": "kremalicious",
+ "siteTitleShort": "krlc",
+ "siteDescription": "Blog of designer & developer Matthias Kretschmann",
+ "siteUrl": "https://kremalicious.com",
+ "author": {
+ "name": "Matthias Kretschmann",
+ "email": "m@kretschmann.io",
+ "uri": "https://matthiaskretschmann.com",
+ "twitter": "https://twitter.com/kremalicious",
+ "github": "https://github.com/kremalicious",
+ "facebook": "https://facebook.com/matthiaskretschmann",
+ "bitcoin": "171qDmKEXm9YBgBLXyGjjPvopP5o9htQ1V",
+ "ether": "0x339dbC44d39bf1961E385ed0Ae88FC6069b87Ea1"
+ },
+ "typekitID": "msu4qap",
+ "menu": [
+ {
+ "title": "Photos",
+ "link": "/photos"
+ },
+ {
+ "title": "Goodies",
+ "link": "/tags/goodies"
+ },
+ {
+ "title": "Tags",
+ "link": "/tags"
+ }
+ ],
+ "rss": "/feed.xml",
+ "jsonfeed": "/feed.json",
+ "itemsPerPage": 20,
+ "repoContentPath": "https://github.com/kremalicious/blog/tree/master/content"
+ }
+ }
+}
diff --git a/jest/__fixtures__/photos.json b/jest/__fixtures__/photos.json
new file mode 100644
index 00000000..3de6a58f
--- /dev/null
+++ b/jest/__fixtures__/photos.json
@@ -0,0 +1,62 @@
+{
+ "photos": {
+ "edges": [
+ {
+ "node": {
+ "id": "6effe45d-0884-527c-9fba-6f7f567979fd",
+ "frontmatter": {
+ "title": "Országház II",
+ "type": "photo",
+ "image": {
+ "childImageSharp": {
+ "fluid": {
+ "aspectRatio": 1,
+ "src": "/static/2dbcf257b4bdf625c24fede935d32425/2423a/2019-11-03-orszaghaz-ii.jpg",
+ "srcSet": "/static/2dbcf257b4bdf625c24fede935d32425/b7835/2019-11-03-orszaghaz-ii.jpg 100w,\n/static/2dbcf257b4bdf625c24fede935d32425/2de44/2019-11-03-orszaghaz-ii.jpg 200w,\n/static/2dbcf257b4bdf625c24fede935d32425/2423a/2019-11-03-orszaghaz-ii.jpg 400w,\n/static/2dbcf257b4bdf625c24fede935d32425/66039/2019-11-03-orszaghaz-ii.jpg 600w,\n/static/2dbcf257b4bdf625c24fede935d32425/ba820/2019-11-03-orszaghaz-ii.jpg 800w,\n/static/2dbcf257b4bdf625c24fede935d32425/d04d5/2019-11-03-orszaghaz-ii.jpg 3793w",
+ "srcWebp": "/static/2dbcf257b4bdf625c24fede935d32425/33771/2019-11-03-orszaghaz-ii.webp",
+ "srcSetWebp": "/static/2dbcf257b4bdf625c24fede935d32425/4f5da/2019-11-03-orszaghaz-ii.webp 100w,\n/static/2dbcf257b4bdf625c24fede935d32425/72345/2019-11-03-orszaghaz-ii.webp 200w,\n/static/2dbcf257b4bdf625c24fede935d32425/33771/2019-11-03-orszaghaz-ii.webp 400w,\n/static/2dbcf257b4bdf625c24fede935d32425/f12d8/2019-11-03-orszaghaz-ii.webp 600w,\n/static/2dbcf257b4bdf625c24fede935d32425/b975c/2019-11-03-orszaghaz-ii.webp 800w,\n/static/2dbcf257b4bdf625c24fede935d32425/f7332/2019-11-03-orszaghaz-ii.webp 3793w",
+ "sizes": "(max-width: 400px) 100vw, 400px",
+ "originalImg": "/static/2dbcf257b4bdf625c24fede935d32425/d04d5/2019-11-03-orszaghaz-ii.jpg",
+ "originalName": "2019-11-03-orszaghaz-ii.jpg",
+ "presentationWidth": 400,
+ "presentationHeight": 300
+ }
+ }
+ }
+ },
+ "fields": {
+ "slug": "/orszaghaz-ii/"
+ }
+ }
+ },
+ {
+ "node": {
+ "id": "c80697e5-681d-5fcc-9dab-c3a3821ff0b1",
+ "frontmatter": {
+ "title": "Országház I",
+ "type": "photo",
+ "image": {
+ "childImageSharp": {
+ "fluid": {
+ "aspectRatio": 1,
+ "src": "/static/36d87329aeeda296ae923606e5a4a785/2423a/2019-11-02-orszaghaz-i.jpg",
+ "srcSet": "/static/36d87329aeeda296ae923606e5a4a785/b7835/2019-11-02-orszaghaz-i.jpg 100w,\n/static/36d87329aeeda296ae923606e5a4a785/2de44/2019-11-02-orszaghaz-i.jpg 200w,\n/static/36d87329aeeda296ae923606e5a4a785/2423a/2019-11-02-orszaghaz-i.jpg 400w,\n/static/36d87329aeeda296ae923606e5a4a785/66039/2019-11-02-orszaghaz-i.jpg 600w,\n/static/36d87329aeeda296ae923606e5a4a785/ba820/2019-11-02-orszaghaz-i.jpg 800w,\n/static/36d87329aeeda296ae923606e5a4a785/c9c86/2019-11-02-orszaghaz-i.jpg 3708w",
+ "srcWebp": "/static/36d87329aeeda296ae923606e5a4a785/33771/2019-11-02-orszaghaz-i.webp",
+ "srcSetWebp": "/static/36d87329aeeda296ae923606e5a4a785/4f5da/2019-11-02-orszaghaz-i.webp 100w,\n/static/36d87329aeeda296ae923606e5a4a785/72345/2019-11-02-orszaghaz-i.webp 200w,\n/static/36d87329aeeda296ae923606e5a4a785/33771/2019-11-02-orszaghaz-i.webp 400w,\n/static/36d87329aeeda296ae923606e5a4a785/f12d8/2019-11-02-orszaghaz-i.webp 600w,\n/static/36d87329aeeda296ae923606e5a4a785/b975c/2019-11-02-orszaghaz-i.webp 800w,\n/static/36d87329aeeda296ae923606e5a4a785/262c1/2019-11-02-orszaghaz-i.webp 3708w",
+ "sizes": "(max-width: 400px) 100vw, 400px",
+ "originalImg": "/static/36d87329aeeda296ae923606e5a4a785/c9c86/2019-11-02-orszaghaz-i.jpg",
+ "originalName": "2019-11-02-orszaghaz-i.jpg",
+ "presentationWidth": 400,
+ "presentationHeight": 297
+ }
+ }
+ }
+ },
+ "fields": {
+ "slug": "/orszaghaz-i/"
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/jest/__fixtures__/post.json b/jest/__fixtures__/post.json
new file mode 100644
index 00000000..54821d04
--- /dev/null
+++ b/jest/__fixtures__/post.json
@@ -0,0 +1,41 @@
+{
+ "post": {
+ "html": "
There are many reasons you might want to browse anonymously which can be accomplished by using Tor. The setup instructions on Tor’s website are quite scattered and outdated so here are some steps to setup Tor on macOS with a simple automated script at the end.
\n
I’m using macOS Catalina (10.15) for the following instructions but it should work on almost any macOS version.
The most simple way to surf anonymously with Tor is to just grab Tor Browser. It’s a modified version of Firefox Extended Support Release (ESR) with Tor and some extensions (Torbutton, TorLauncher, NoScript, and HTTPS-Everywhere) built right in. Upon start, Tor Browser automatically starts the required Tor background processes and routes traffic through the Tor network. That’s the way to go if you want the highest level of protection without much further configuration.
\n
But it’s based on an older version of Firefox and there might be more you want to do anonymously on your machine than just browsing the web, like accessing resources via the Terminal or any other app. Or just use the browser you’re used to.
\n
For this you need to have Tor installed on your system and additionally set specific proxy values in your network preferences after you’ve started Tor.
\n
\n
Be aware that the instructions and the script mentioned below will not make whatever you do on the web anonymous. Much depends on your browsing habits, what apps you're using, and none of the methods below will offer the same level of protection than Tor Browser out of the box. You have been warned.
Congratulations, you now have Tor running on your system. But none of your network traffic is routed through it yet.
\n
In order for all your system traffic being routed through Tor you need to adjust your system’s network proxy settings which you can either do visually in the System Preferences or programmatically via macOS’s builtin networksetup.
\n
#Set network proxy settings via System Preferences
\n
You can do this under System Preferences > Network by creating a specific Tor network location for it:
\n\n
From Location dropdown at the top, select Edit Locations…
\n
Create a new location by hitting the plus button and name it Tor. Hitting Done will select the new location which is now ready to be configured.
\n
Go to Advanced > Proxies and activate SOCKS Proxy and add those values:
\n
SOCKS proxy server: localhost
\n
Port: 9050
\n\n\n
After hitting OK & Apply at the initial network screen, you can easily switch to this newly created location from your menu bar under  > Location whenever you start up Tor.
\n
Switching to the Tor location routes all network traffic on your system through Tor. Note that you have to repeat those steps for every other network interface if you use, say, Wi-Fi and Ethernet interchangeably.
\n
#All in one go: start Tor & set network proxy settings automatically
\n
When you’re already in the Terminal to start up Tor, additionally setting the network settings involves a lot of fiddling around. Ain’t nobody got time for that.
\n
Thankfully macOS provides a way to programmatically set those proxy values via the networksetup utility. I’ve found a nice script for this but running it opened multiple admin password prompts. So I extended it a bit to make it more user friendly.
\n
In a nutshell, this shell script asks you for your admin password upfront, starts up Tor, and sets all required proxy network settings automatically:
\n
#!/usr/bin/env bash\n\n# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet'\nINTERFACE=Wi-Fi\n\n# Ask for the administrator password upfront\nsudo -v\n\n# Keep-alive: update existing `sudo` time stamp until finished\nwhiletrue;do sudo -n true; sleep 60;kill -0 "$$"||exit;done2>/dev/null &\n\n# trap ctrl-c and call disable_proxy()\nfunctiondisable_proxy(){\n sudo networksetup -setsocksfirewallproxystate $INTERFACE off\necho"$(tput setaf 64)"#green\necho"SOCKS proxy disabled."\necho"$(tput sgr0)"# color reset\n}\ntrap disable_proxy INT\n\n# Let's roll\nsudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off\nsudo networksetup -setsocksfirewallproxystate $INTERFACE on\n\necho"$(tput setaf 64)"# green\necho"SOCKS proxy 127.0.0.1:9050 enabled."\necho"$(tput setaf 136)"# orange\necho"Starting Tor..."\necho"$(tput sgr0)"# color reset\n\ntor
\n
Save this script under something like tor.sh in one of your sourced bin folders, make it executable with chmod + x and use it as a replacement for the general tor command. So you can just run
\n
tor.sh
\n
and Tor should run smoothly on your system without additional configuration:
\n\n
Verify you’re indeed browsing over the Tor network by going to check.torproject.org.
\n
When you’re done, just exit the script with ctrl + c and the network settings will be reverted to their previous configuration.
Some apps are just not good Mac citizens and use their own network settings, ignoring macOS system network proxy settings. E.g. older versions of Google Chrome were using their own custom network settings and therefore were not routing their web traffic through the proxy configured in System Preferences.
\n
But the most recent Chrome version automatically picks up macOS’s native proxy settings, as does the most recent version of Firefox.
\n
Always check your Tor connection with whatever app you’re using and if needed set the proxy preferences manually in the respective app with:
\n
\n
SOCKS proxy server: localhost
\n
Port: 9050
\n
\n",
+ "excerpt": "There are many reasons you might want to browse anonymously which can be accomplished by using Tor. The setup instructions on Tor’s website…",
+ "frontmatter": {
+ "type": "post",
+ "title": "Simple Tor setup on macOS",
+ "image": {
+ "childImageSharp": {
+ "fluid": {
+ "aspectRatio": 3.2,
+ "src": "/static/c87c817b4191fb48e9ca4419c0c70bb8/3995d/teaser-tor.png",
+ "srcSet": "/static/c87c817b4191fb48e9ca4419c0c70bb8/f0031/teaser-tor.png 200w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/cad89/teaser-tor.png 400w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/3995d/teaser-tor.png 800w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/32ce4/teaser-tor.png 1200w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/1ed7e/teaser-tor.png 1600w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/19dc3/teaser-tor.png 1920w",
+ "srcWebp": "/static/c87c817b4191fb48e9ca4419c0c70bb8/240ac/teaser-tor.webp",
+ "srcSetWebp": "/static/c87c817b4191fb48e9ca4419c0c70bb8/04c4c/teaser-tor.webp 200w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/ebea1/teaser-tor.webp 400w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/240ac/teaser-tor.webp 800w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/823f0/teaser-tor.webp 1200w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/9e49e/teaser-tor.webp 1600w,\n/static/c87c817b4191fb48e9ca4419c0c70bb8/68ae1/teaser-tor.webp 1920w",
+ "sizes": "(max-width: 800px) 100vw, 800px",
+ "originalImg": "/static/c87c817b4191fb48e9ca4419c0c70bb8/19dc3/teaser-tor.png",
+ "originalName": "teaser-tor.png",
+ "presentationWidth": 800,
+ "presentationHeight": 250
+ }
+ },
+ "fields": null
+ },
+ "toc": true,
+ "author": "Matthias Kretschmann",
+ "updated": "2019-11-07T22:52:46.000Z",
+ "tags": ["tutorial", "tor", "macos", "goodies", "apple"],
+ "linkurl": null,
+ "style": null,
+ "changelog": null
+ },
+ "fields": {
+ "slug": "/simple-tor-setup-on-mac-os-x",
+ "date": "2015-08-02T19:57:30.912Z",
+ "githubLink": "https://github.com/kremalicious/blog/tree/master/content/posts/2015-08-02-simple-tor-setup-on-mac-os-x/index.md"
+ },
+ "rawMarkdownBody": "\nThere are many reasons you might want to browse anonymously which can be accomplished by using [Tor](https://www.torproject.org). The setup instructions on Tor's website are quite scattered and outdated so here are some steps to setup Tor on macOS with a simple automated script at the end.\n\nI'm using macOS Catalina (10.15) for the following instructions but it should work on almost any macOS version.\n\n## Tor Browser\n\n![Tor Browser](tor-browser.png)\n\nThe most simple way to surf anonymously with Tor is to just grab [Tor Browser](https://www.torproject.org/projects/torbrowser.html.en). It's a modified version of [Firefox Extended Support Release (ESR)](https://www.mozilla.org/en-US/firefox/organizations/) with Tor and some extensions (Torbutton, TorLauncher, NoScript, and HTTPS-Everywhere) built right in. Upon start, Tor Browser automatically starts the required Tor background processes and routes traffic through the Tor network. That's the way to go if you want the highest level of protection without much further configuration.\n\nBut it's based on an older version of Firefox and there might be more you want to do anonymously on your machine than just browsing the web, like accessing resources via the Terminal or any other app. Or just use the browser you're used to.\n\nFor this you need to have Tor installed on your system and additionally set specific proxy values in your network preferences after you've started Tor.\n\n
\n
Be aware that the instructions and the script mentioned below will not make whatever you do on the web anonymous. Much depends on your browsing habits, what apps you're using, and none of the methods below will offer the same level of protection than Tor Browser out of the box. You have been warned.
\n
\n\n## Install Tor\n\nContrary to the weirdly outdated [install instructions on Tor's website](https://www.torproject.org/docs/tor-doc-osx.html.en) (hey, remember Macports?), installing Tor on macOS is super simple with [Homebrew](http://brew.sh).\n\nIn your Terminal execute:\n\n```bash\nbrew install tor\n```\n\nThen you can start it up by running:\n\n```bash\ntor\n```\n\nCongratulations, you now have Tor running on your system. But none of your network traffic is routed through it yet.\n\nIn order for all your system traffic being routed through Tor you need to adjust your system's network proxy settings which you can either do visually in the System Preferences or programmatically via macOS's builtin `networksetup`.\n\n## Set network proxy settings via System Preferences\n\nYou can do this under _System Preferences > Network_ by creating a specific Tor network location for it:\n\n1. From Location dropdown at the top, select _Edit Locations..._\n2. Create a new location by hitting the plus button and name it _Tor_. Hitting Done will select the new location which is now ready to be configured.\n3. Go to _Advanced > Proxies_ and activate _SOCKS Proxy_ and add those values:\n\n- _SOCKS proxy server_: `localhost`\n- _Port_: `9050`\n\n![Network Settings](tor-osx-proxy.png)\n\nAfter hitting _OK_ & _Apply_ at the initial network screen, you can easily switch to this newly created location from your menu bar under _ > Location_ whenever you start up Tor.\n\nSwitching to the Tor location routes all network traffic on your system through Tor. Note that you have to repeat those steps for every other network interface if you use, say, Wi-Fi and Ethernet interchangeably.\n\n## All in one go: start Tor & set network proxy settings automatically\n\nWhen you're already in the Terminal to start up Tor, additionally setting the network settings involves a lot of fiddling around. Ain't nobody got time for that.\n\nThankfully macOS provides a way to programmatically set those proxy values via the `networksetup` utility. I've found a [nice script](http://leonid.shevtsov.me/en/an-easy-way-to-use-tor-on-os-x) for this but running it opened multiple admin password prompts. So I extended it a bit to make it more user friendly.\n\nIn a nutshell, this shell script asks you for your admin password upfront, starts up Tor, and sets all required proxy network settings automatically:\n\n```bash\n#!/usr/bin/env bash\n\n# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet'\nINTERFACE=Wi-Fi\n\n# Ask for the administrator password upfront\nsudo -v\n\n# Keep-alive: update existing `sudo` time stamp until finished\nwhile true; do sudo -n true; sleep 60; kill -0 \"$$\" || exit; done 2>/dev/null &\n\n# trap ctrl-c and call disable_proxy()\nfunction disable_proxy() {\n sudo networksetup -setsocksfirewallproxystate $INTERFACE off\n echo \"$(tput setaf 64)\" #green\n echo \"SOCKS proxy disabled.\"\n echo \"$(tput sgr0)\" # color reset\n}\ntrap disable_proxy INT\n\n# Let's roll\nsudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off\nsudo networksetup -setsocksfirewallproxystate $INTERFACE on\n\necho \"$(tput setaf 64)\" # green\necho \"SOCKS proxy 127.0.0.1:9050 enabled.\"\necho \"$(tput setaf 136)\" # orange\necho \"Starting Tor...\"\necho \"$(tput sgr0)\" # color reset\n\ntor\n```\n\nSave this script under something like `tor.sh` in one of your sourced `bin` folders, make it executable with `chmod + x` and use it as a replacement for the general `tor` command. So you can just run\n\n```bash\ntor.sh\n```\n\nand Tor should run smoothly on your system without additional configuration:\n\n![Tor running in Terminal](tor-osx-terminal.png)\n\nVerify you're indeed browsing over the Tor network by going to [check.torproject.org](https://check.torproject.org).\n\nWhen you're done, just exit the script with ctrl + c and the network settings will be reverted to their previous configuration.\n\n## Non-standard apps\n\nSome apps are just not good Mac citizens and use their own network settings, ignoring macOS system network proxy settings. E.g. older versions of Google Chrome were using their own custom network settings and therefore were not routing their web traffic through the proxy configured in System Preferences.\n\nBut the most recent Chrome version automatically picks up macOS's native proxy settings, as does the most recent version of Firefox.\n\nAlways [check](https://check.torproject.org) your Tor connection with whatever app you're using and if needed set the proxy preferences manually in the respective app with:\n\n- _SOCKS proxy server_: `localhost`\n- _Port_: `9050`\n",
+ "tableOfContents": "
With Ocean Protocol, you can use centralized storage services like S3, Azure Storage, or your own On-Premise storage to store and retrieve your asset files through Osmosis drivers in Brizo.
\n
But storing asset files in a centralized service poses multiple problems:
\n
\n
one entity controls the data
\n
one entity is legally responsible for all stored data
\n
creates a single point of failure
\n
if service goes offline, asset files can’t be consumed
\n
opening up possibilities of censorship by the entity running the service, or the service itself
\n
if files are moved to another location within the same service, existing URLs break
\n
\n
Initially created to store and efficiently move scientific data sets, the InterPlanetary File System (IPFS) solves all those issues with its goal of transforming the vastly centralized web into a distributed peer-to-peer network.
\n
Files are distributed among multiple nodes, eliminating the single point of failure, legal, and censorship issues. By using content-based instead of location-based addressing of files, URLs won’t break if files are moved.
\n
So we defined OEP-15 to make the ipfs:// protocol a first-class citizen in the Ocean Protocol stack, allowing you to store asset files on IPFS, and use their native IPFS URLs during the publish process.
In short, every component in the Ocean Protocol stack now supports publishing and consuming of asset files stored in IPFS which includes support for native IPFS URLs, referencing files with their Content Identifiers (CIDs).
Every file stored on IPFS is public by default, so it made perfect sense using this in our Commons Marketplace first. We went through multiple prototypes to end up with our final setup.
\n
During the publish flow you will find an extended Files section for adding a file from an existing URL, and for adding a local file from your device to IPFS.
\n\n
The existing URL field now supports ipfs:// in addition to http(s):// so if you have an existing asset on IPFS, you can add it here and everything works as before. With the exception that the asset files will be registered with this native IPFS URL.
\n
The new IPFS drop zone provides a convenient way to add and register unpublished asset files.
\n\n
That drop zone allows you to add a file from your local machine and add it to IPFS during the asset publish flow in a snap:
First, opening up the drop zone area will ping the IPFS node & gateway to check connectivity. Dropping or selecting a file from your device onto that area does a bunch of things in the background:
\n\n
Will add that file to an IPFS node with js-ipfs-http-client, and pin the file so it stays on our node during garbage collection. We wrapped the HTTP client into our own custom React Hook.
\n
The file will be wrapped into a directory to preserve the original file name, so we end up with a URL like ipfs://QmX5LRpEVocfks9FNDnRoK2imf2fy9mPpP4wfgaDVXWfYD/video.mp4.
\n
The returned CID is used to ping that file over an IPFS gateway to make it globally available.
\n
The IPFS gateway URL is passed to our Commons Server file checker, extracting some file metadata and checking for availability of the file.
\n
The native IPFS url is passed to the list of asset files, and it will show up in the file list.
\n
Upon final asset publishing, the native IPFS URL is stored encrypted in the asset DID Descriptor Object (DDO) as defined in OEP-8.
\n\n
All these steps are required because of how files in IPFS are distributed among its nodes. When adding a file to a node (note how it’s not called “uploading”) it is only available on that node. Requesting that file from another node will start the distribution process of the file from the initial IPFS node, making it globally available.
\n
Also the consume flow required some changes. Whenever an asset file stored on IPFS is requested to be downloaded, multiple things related to IPFS are happening in Brizo with its shiny new osmosis-ipfs-driver:
\n\n
The file URLs are decrypted upon successful fulfilling of all conditions.
\n
The native ipfs:// url is mapped to its https:// gateway URL.
\n
File is downloaded from that gateway URL.
\n
In case a direct file URL was used instead of being folder-wrapped (e.g. ipfs://QmPQNaNxHkasNiJBFZht2k3zCEBkvEu1aE5VNGZ8QiT8Nj), the proper file ending will be added automatically at the end of the download process, based on detected MIME type.
\n\n
#🏄‍♀️ Ocean Protocol’s Public IPFS Node & Gateway
\n
While developing this feature, it became clear we need to run our own IPFS node & gateway to have better control over the whole experience. And donating a node instead of taking away bandwidth from the main IPFS gateway (gateway.ipfs.io) felt like the right thing to do to make Juan happy.
\n
So we created ipfs.oceanprotocol.com, run by us (that is, legally speaking, BigchainDB GmbH).
\n\n
It is setup to be a public gateway, and provide some access to its node HTTP API for everyone. This means you can use it to address any content in the IPFS network, like:
At the same time all node API functionality required by Commons is open to the world, so those endpoints can be used by anyone to add files to IPFS:
\n
\n
/api/v0/add
\n
/api/v0/version
\n
/api/v0/id
\n
\n
As a start, this is a simple single node but we plan to gradually upgrade ipfs.oceanprotocol.com to a full IPFS Cluster of multiple nodes for best data availability.
Beside upgrading to an IPFS Cluster there are many ways the process will be improved over time. At the moment the drop zone in Commons only supports single file uploads, so a quick win improvement would be to allow dropping multiple files at once. Likewise, the drop zone using js-ipfs-http-client comes with some bugs when trying to upload larger files.
\n
To make the process of adding files to the IPFS node less dependent on the client browser, it could be moved into a background task in the Commons Server. This should also give more control and feedback for the process of distributing a file from the initial node to other nodes.
\n
And finally, further work may be done to store files encrypted on IPFS and implement a way to decrypt them in an Ocean Protocol network.