From 97d4b84de0733fe4704f1863852e3465a6bb9c51 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 9 May 2016 02:36:18 +0100 Subject: [PATCH] initial commit. vaguely works, but needs cosmetics --- LICENSE | 177 ++++++++++++++++++ README.md | 40 ++++ img/matrix-logo.svg | 49 +++++ index.html | 12 ++ package.json | 34 ++++ site.css | 138 ++++++++++++++ src/components/Footer.js | 27 +++ src/components/Header.js | 27 +++ src/components/HomePage.js | 362 +++++++++++++++++++++++++++++++++++++ src/components/Site.js | 41 +++++ src/index.js | 22 +++ webpack.config.js | 22 +++ 12 files changed, 951 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 img/matrix-logo.svg create mode 100644 index.html create mode 100644 package.json create mode 100644 site.css create mode 100644 src/components/Footer.js create mode 100644 src/components/Header.js create mode 100644 src/components/HomePage.js create mode 100644 src/components/Site.js create mode 100644 src/index.js create mode 100644 webpack.config.js diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f433b1a --- /dev/null +++ b/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md new file mode 100644 index 0000000..99e4cf8 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +Matrix.to +---------- + +Matrix.to is a simple stateless privacy-protecting URL redirecting service, +which lets users share links to entities in the Matrix.org ecosystem without +being tied to any specific app. This lets users choose their own favourite +Matrix client to participate in conversations rather than being forced to use +the same app as whoever sent the link. + +Matrix.to preserves user privacy by not sharing any information about the links +being followed with the Matrix.to server - the redirection is calculated +entirely clientside using JavaScript, and the link details is hidden behind a +fragment to avoid web clients leaking it to the server. + +Matrix.to links are designed to be human-friendly, both for reading and +constructing, and are essentially a compatibility step in the journey towards a +ubiquitous mx:// URL scheme (see https://matrix.org/jira/browse/SPEC-5). + +Anyone is welcome to host their own version of the Matrix.to app - Matrix.to is +**not** a single point of failure on the Matrix ecosystem; if the matrix.to +deployment ever failed, users could trivially copy the room/user/message details +out of the URLs and follow them manually, or change the hostname to point at an +alternative deployment of the service. The Matrix.to service could also be +hosted in an immutable/signed environment such as IPFS to further increase its +availability and avoid tampering. + +The matrix.to URL scheme is: + +| Entity type: | Example URL | +|--------------|-------------------------------------------------------------------| +| Rooms: | https://matrix.to/#/#matrix:matrix.org | +| Users: | https://matrix.to/#/@matthew:matrix.org | +| Messages: | https://matrix.to/#/#matrix:matrix.org/$1448831580433WbpiJ:jki.re | + +The #/ component is optional, and exists to avoid leaking the target URL to the +server hosting matrix.to. https://matrix.to/@matthew:matrix.org works too, and +provides better legibility at the expense of privacy. + +(Technically the # and @ in the URL fragment should probably be escaped, but in +practice for legibility we bend the rules and include it verbatim) diff --git a/img/matrix-logo.svg b/img/matrix-logo.svg new file mode 100644 index 0000000..1bdcd23 --- /dev/null +++ b/img/matrix-logo.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..fa8a9f3 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + [matrix] + + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..ca80eea --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "matrix-to", + "version": "0.0.1", + "description": "Stateless privacy-protecting URL redirecting service for the Matrix.org ecosystem", + "main": "src/index.js", + "scripts": { + "build": "NODE_ENV=production webpack -p src/index.js bundle.js", + "start": "webpack -w src/index.js bundle.js", + "test": "echo \"Error: no test specified\" && exit 1", + "clean": "rm bundle.js bundle.js.map" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/matrix-org/matrix.to.git" + }, + "author": "Matrix.org", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/matrix-org/matrix.to/issues" + }, + "homepage": "https://matrix.to", + "dependencies": { + "react": "^15.0.1", + "react-dom": "^15.0.2" + }, + "devDependencies": { + "babel-core": "^6.8.0", + "babel-loader": "^6.2.4", + "babel-preset-es2015": "^6.6.0", + "babel-preset-react": "^6.5.0", + "source-map-loader": "^0.1.5", + "webpack": "^1.13.0" + } +} diff --git a/site.css b/site.css new file mode 100644 index 0000000..2aaf160 --- /dev/null +++ b/site.css @@ -0,0 +1,138 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +body { + margin: 0px; + font-family: "Open Sans", Helvetica, Arial, sans-serif; + color: #454545; + font-size: 15px; +} + +.mxt_Site { +} + +.mxt_Header { +} + +.mxt_Footer { +} + +.mxt_HomePage { + margin: auto; + max-width: 1000px; +} + +.mxt_HomePage_logo { + padding-top: 50px; + padding-bottom: 50px; + display: block; + margin: auto; +} + +.mxt_HomePage_cta { + padding: 50px; + padding-bottom: 30px; + text-align: center; + font-size: 20px; +} + +.mxt_HomePage_inputBox { + text-align: center; + color: #000; + font-size: 24px; +} + +.mxt_HomePage_inputBox_prompt { + display: inline; + font-size: 24px; + font-family: "Open Sans", Helvetica, Arial, sans-serif; + margin-right: 5px; +} + +.mxt_HomePage_inputBox_button { + display: inline; + border: 0px solid; + border-radius: 5px; + font-size: 20px; + font-family: "Open Sans", Helvetica, Arial, sans-serif; + padding: 7px 14px 7px 14px; + margin: 5px; + background-color: #454545; + color: #fff; + font-weight: bold; +} + +.mxt_HomePage_error { + background-color: #f88; + padding: 10px 20px 10px 20px; + border: 1px solid #f00; + border-radius: 5px; + margin: auto; + margin-top: 20px; + width: 50%; + font-size: 18px; +} + +.mxt_HomePage_links { + margin-top: 50px; +} + +.mxt_HomePage_links_intro { + font-size: 16px; +} + +.mxt_HomePage_link { + display: table-row; +} + +.mxt_HomePage_link_logo, +.mxt_HomePage_link_name, +.mxt_HomePage_link_author, +.mxt_HomePage_link_maturity, +.mxt_HomePage_link_link, +.mxt_HomePage_link_instructions, +.mxt_HomePage_link_comments { + display: table-cell; + padding: 5px; +} + +.mxt_HomePage_link_logo { +} + +.mxt_HomePage_link_name { +} + +.mxt_HomePage_link_author { +} + +.mxt_HomePage_link_homepage { + font-size: 12px; +} + +.mxt_HomePage_link_maturity { +} + +.mxt_HomePage_link_link { +} + +.mxt_HomePage_link_instructions { +} + +.mxt_HomePage_link_comments { +} + +.mxt_HomePage_info { +} diff --git a/src/components/Footer.js b/src/components/Footer.js new file mode 100644 index 0000000..3345618 --- /dev/null +++ b/src/components/Footer.js @@ -0,0 +1,27 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react' + + +export default React.createClass({ + render() { + return ( +
+
+ ); + } +}) diff --git a/src/components/Header.js b/src/components/Header.js new file mode 100644 index 0000000..2f5dda8 --- /dev/null +++ b/src/components/Header.js @@ -0,0 +1,27 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react' + + +export default React.createClass({ + render() { + return ( +
+
+ ); + } +}) diff --git a/src/components/HomePage.js b/src/components/HomePage.js new file mode 100644 index 0000000..632fb54 --- /dev/null +++ b/src/components/HomePage.js @@ -0,0 +1,362 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react' + +var linkable_clients = [ + { + name: "Vector", + logo: "", + author: "Vector.im", + homepage: "https://vector.im", + room_url: "https://vector.im/beta/#/room/", + user_url: "https://vector.im/beta/#/user/", + msg_url: "https://vector.im/beta/#/room/", + maturity: "Late beta", + comments: "Fully-featured Matrix client for Web, iOS & Android", + }, + { + name: "Matrix Console", + logo: "", + author: "Matrix.org", + homepage: "https://matrix.org", + room_url: "https://matrix.org/beta/#/room/", + user_url: null, + maturity: "Deprecated", + comments: "The original developer-focused client for Web, iOS & Android", + }, + { + name: "PTO (Perpetually Talking Online", + logo: "", + author: "Torrie Fischer", + homepage: "https://pto.im", + room_url: "irc://irc.matrix.org/", + user_url: null, + maturity: "Alpha", + comments: "Access any room anywhere in Matrix via good old IRC!", + }, +]; + +var unlinkable_clients = [ + { + name: "Weechat", + logo: "", + author: "Tor Hveem", + homepage: "https://github.com/torhve/weechat-matrix-protocol-script", + maturity: "Late beta", + room_instructions: "Type /join $entity", + user_instructions: "Type /invite $entity", + comments: "Commandline Matrix interface using Weechat", + }, + { + name: "Quaternion", + logo: "", + author: "Felix Rohrbach", + homepage: "https://github.com/Fxrh/Quaternion", + maturity: "Late alpha", + room_instructions: "Type /join $entity", + user_instructions: "Type /invite $entity", + comments: "Qt5 and C++ cross-platform desktop Matrix client", + }, + { + name: "Tensor", + logo: "", + author: "David A Roberts", + homepage: "https://github.com/davidar/tensor", + maturity: "Late alpha", + room_instructions: "Type /join $entity", + user_instructions: "Type /invite $entity", + comments: "QML and JS cross-platform desktop Matrix client", + }, + { + name: "Tensor2", + logo: "", + author: "David A Roberts", + homepage: "https://github.com/davidar/tensor2", + maturity: "Alpha", + room_instructions: "Type /join $entity", + user_instructions: "Type /invite $entity", + comments: "QML and C++ cross-platform desktop Matrix client", + }, + { + name: "Mclient.el", + logo: "", + author: "Ryan Rix", + homepage: "http://fort.kickass.systems:10082/cgit/personal/rrix/pub/matrix.el.git/", + maturity: "Alpha", + comments: "Matrix client for Gnu Emacs", + } +]; + +export default React.createClass({ + + getInitialState() { + return { + error: null, + entity: null, + showLink: false, + } + }, + + onHashChange() { + var entity = window.location.hash.substr(2); // strip off #/ prefix + if (!entity) { + this.setState({ + entity: null, + showLink: false, + }); + return; + } + + if (!this.isAliasValid(entity) && !this.isUserIdValid(entity) && !this.isMsglinkValid(entity)) { + this.setState({ + entity: entity, + error: "Invalid room alias, user ID or message permalink", + }); + return; + } + this.setState({ + entity: entity, + showLink: true, + }); + }, + + componentWillMount() { + if (window.location.hash) { + this.onHashChange(); + } + }, + + componentDidMount() { + window.addEventListener("hashchange", this.onHashChange); + }, + + componentWillUnmount() { + window.removeEventListener("hashchange", this.onHashChange); + }, + + onSubmit(ev) { + ev.preventDefault(); + + var entity = this.refs.prompt.value.trim(); + if (!this.isAliasValid(entity) && !this.isUserIdValid(entity)) { + this.setState({ error: "Invalid room alias or user ID" }); + return; + } + var loc = window.location; + loc.hash = "#/" + entity; + window.location.assign(loc.href); + this.setState({ + showLink: true, + entity: entity, + }); + }, + + // XXX: cargo-culted from matrix-react-sdk + isAliasValid(alias) { + // XXX: FIXME SPEC-1 + return (alias.match(/^#([^\/:,]+?):(.+)$/) && encodeURI(alias) === alias); + }, + + isUserIdValid(userId) { + // XXX: FIXME SPEC-1 + return (userId.match(/^@([^\/:,]+?):(.+)$/) && encodeURI(userId) === userId); + }, + + isMsglinkValid(msglink) { + // XXX: FIXME SPEC-1 + return (msglink.match(/^(\!#)([^\/:,]+?):(.+)\/\$[^\/:,]+?:(.+)$/) && encodeURI(msglink) === msglink); + }, + + render() { + var error; + if (this.state.error) { + error =
{ this.state.error }
+ } + + var prompt; + if (this.state.showLink) { + var link = "https://matrix.to/#/" + this.state.entity; + + var isRoom = this.isAliasValid(this.state.entity); + var isUser = this.isUserIdValid(this.state.entity); + var isMsg = this.isMsglinkValid(this.state.entity); + + var links; + + // name: "Vector", + // logo: "", + // author: "Vector.im", + // link: "https://vector.im", + // room_url: "https://vector.im/beta/#/room/", + // user_url: "https://vector.im/beta/#/user/", + // maturity: "Late beta", + // comments: "Fully-featured Matrix client for Web, iOS & Android", + + links = ( +
+
+

+ Matrix is an ecosystem for open and interoperable communication. +

+

+ To connect to { this.state.entity }, please select an app: +

+
+ + { linkable_clients.map((client) => { + var link; + if (isRoom && client.room_url) { + link = client.room_url + this.state.entity; + } + else if (isUser && client.user_url) { + link = client.user_url + this.state.entity; + } + else if (isMsg && client.msg_url) { + link = client.msg_url + this.state.entity; + } + if (!link) return
; + + var link = isRoom ? client.room_url + this.state.entity : client.user_url + this.state.entity; + return ( +
+
+ +
+
+ { client.name } + +
+
+ { client.comments } +
+
+ { client.author } +
+
+ { client.maturity } +
+
+ { link } +
+
+ ); + })} + { unlinkable_clients.map((client) => { + var instructions; + if (isRoom && client.room_instructions) { + instructions = client.room_instructions.replace("$entity", this.state.entity); + } + else if (isUser && client.user_instructions) { + instructions = client.user_instructions.replace("$entity", this.state.entity); + } + else if (isMsg && client.msg_instructions) { + instructions = client.msg_instructions.replace("$entity", this.state.entity); + } + if (!instructions) return
; + + return ( +
+
+ +
+ +
+ { client.comments } +
+
+ { client.author } +
+
+ { client.maturity } +
+
+ { instructions } +
+
+ ); + })} + +

+ To add clients to this list, please contact us or + simply send us a pull request on github! +

+
+ ); + + prompt = [ +
+ { link } + { error } +
, + links + ]; + } + else { + prompt = [ +
+
+ + +
+ { error } +
, +
+ Create shareable links to Matrix rooms, users or messages
+ without being tied to a specific app. +
+ ]; + } + + return ( +
+ + [matrix] + + + { prompt } + +
+

About

+

+ Matrix.to is a simple stateless URL redirecting service + which lets users share links to entities in the Matrix.org + ecosystem without being tied to any specific app. This lets users choose their own favourite + Matrix client to participate in conversations rather than being forced to use the same app as + whoever sent the link. +

+

+ The service preserves user privacy by not + sharing any information about the links being followed with the Matrix.to server - the + redirection is calculated entirely clientside using JavaScript. +

+

+ Links are designed to be human-friendly, both for reading and constructing, and are + essentially a compatibility step in the journey towards + a ubiquitous mx:// URL scheme. +

+
+
+ ); + } +}) diff --git a/src/components/Site.js b/src/components/Site.js new file mode 100644 index 0000000..adace65 --- /dev/null +++ b/src/components/Site.js @@ -0,0 +1,41 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react' + +import Header from './Header' +import Footer from './Footer' +import HomePage from './HomePage' +import LinkPage from './LinkPage' + + +export default React.createClass({ + getInitialState() { + return { + page: , + } + }, + + render() { + return ( +
+
+ { this.state.page } +
+
+ ); + } +}) diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..ed31bc8 --- /dev/null +++ b/src/index.js @@ -0,0 +1,22 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import ReactDOM from 'react-dom' +import React from 'react' + +import Site from './components/Site' + +ReactDOM.render(, document.getElementById('site')) diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..3c114af --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,22 @@ +var path = require('path'); +var webpack = require('webpack'); + +module.exports = { + module: { + preLoaders: [ + { test: /\.js$/, loader: "source-map-loader" } + ], + loaders: [ + { test: /\.json$/, loader: "json" }, + { test: /\.js$/, loader: "babel-loader?presets[]=es2015&presets[]=react", include: path.resolve('./src') }, + ], + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(process.env.NODE_ENV) + } + }), + ], + devtool: 'source-map', +};