initial commit. vaguely works, but needs cosmetics
This commit is contained in:
commit
97d4b84de0
12 changed files with 951 additions and 0 deletions
177
LICENSE
Normal file
177
LICENSE
Normal file
|
@ -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
|
40
README.md
Normal file
40
README.md
Normal file
|
@ -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)
|
49
img/matrix-logo.svg
Normal file
49
img/matrix-logo.svg
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="789.322px" height="336.807px" viewBox="0 0 789.322 336.807" enable-background="new 0 0 789.322 336.807"
|
||||
xml:space="preserve">
|
||||
<path d="M8.876,7.71v321.386h23.13v7.711H0V0h32.006v7.71H8.876z"/>
|
||||
<path d="M97.989,109.594v16.264h0.463c4.338-6.191,9.563-10.998,15.684-14.406c6.117-3.402,13.129-5.11,21.027-5.11
|
||||
c7.588,0,14.521,1.475,20.793,4.415c6.274,2.945,11.038,8.131,14.291,15.567c3.56-5.265,8.4-9.913,14.521-13.94
|
||||
c6.117-4.025,13.358-6.042,21.724-6.042c6.351,0,12.234,0.776,17.66,2.325c5.418,1.549,10.065,4.027,13.938,7.434
|
||||
c3.869,3.41,6.889,7.863,9.062,13.357c2.167,5.504,3.253,12.122,3.253,19.869v80.385h-32.993v-68.074
|
||||
c0-4.025-0.154-7.82-0.465-11.385c-0.313-3.56-1.161-6.656-2.555-9.293c-1.395-2.631-3.45-4.724-6.157-6.274
|
||||
c-2.711-1.543-6.391-2.322-11.037-2.322s-8.403,0.896-11.269,2.671c-2.868,1.784-5.112,4.109-6.737,6.971
|
||||
c-1.626,2.869-2.711,6.12-3.252,9.762c-0.545,3.638-0.814,7.318-0.814,11.035v66.91h-32.991v-67.375c0-3.562-0.081-7.087-0.23-10.57
|
||||
c-0.158-3.487-0.814-6.7-1.978-9.645c-1.162-2.94-3.099-5.304-5.809-7.088c-2.711-1.775-6.699-2.671-11.965-2.671
|
||||
c-1.551,0-3.603,0.349-6.156,1.048c-2.556,0.697-5.036,2.016-7.435,3.949c-2.404,1.938-4.454,4.726-6.158,8.363
|
||||
c-1.705,3.642-2.556,8.402-2.556,14.287v69.701h-32.99V109.594H97.989z"/>
|
||||
<path d="M271.545,127.254c3.405-5.113,7.744-9.215,13.012-12.316c5.264-3.097,11.186-5.303,17.771-6.621
|
||||
c6.582-1.315,13.205-1.976,19.865-1.976c6.042,0,12.158,0.428,18.354,1.277c6.195,0.855,11.85,2.522,16.962,4.997
|
||||
c5.111,2.477,9.292,5.926,12.546,10.338c3.253,4.414,4.879,10.262,4.879,17.543v62.494c0,5.428,0.31,10.611,0.931,15.567
|
||||
c0.615,4.959,1.701,8.676,3.251,11.153h-33.455c-0.621-1.86-1.126-3.755-1.511-5.693c-0.39-1.933-0.661-3.908-0.813-5.923
|
||||
c-5.267,5.422-11.465,9.217-18.585,11.386c-7.127,2.163-14.407,3.251-21.842,3.251c-5.733,0-11.077-0.698-16.033-2.09
|
||||
c-4.958-1.395-9.293-3.562-13.01-6.51c-3.718-2.938-6.622-6.656-8.713-11.147s-3.138-9.84-3.138-16.033
|
||||
c0-6.813,1.199-12.43,3.604-16.84c2.399-4.417,5.495-7.939,9.295-10.575c3.793-2.632,8.129-4.607,13.01-5.923
|
||||
c4.878-1.315,9.795-2.358,14.752-3.137c4.957-0.772,9.835-1.393,14.638-1.857c4.801-0.466,9.062-1.164,12.779-2.093
|
||||
c3.718-0.929,6.658-2.282,8.829-4.065c2.165-1.781,3.172-4.375,3.02-7.785c0-3.56-0.58-6.389-1.742-8.479
|
||||
c-1.161-2.09-2.711-3.719-4.646-4.88c-1.937-1.161-4.183-1.936-6.737-2.325c-2.557-0.382-5.309-0.58-8.248-0.58
|
||||
c-6.506,0-11.617,1.395-15.335,4.183c-3.716,2.788-5.889,7.437-6.506,13.94h-32.991C266.2,138.793,268.133,132.362,271.545,127.254z
|
||||
M336.714,173.837c-2.09,0.696-4.337,1.275-6.736,1.741c-2.402,0.465-4.918,0.853-7.551,1.161c-2.635,0.313-5.268,0.698-7.899,1.163
|
||||
c-2.48,0.461-4.919,1.086-7.317,1.857c-2.404,0.779-4.495,1.822-6.274,3.138c-1.784,1.317-3.216,2.985-4.3,4.994
|
||||
c-1.085,2.014-1.626,4.571-1.626,7.668c0,2.94,0.541,5.422,1.626,7.431c1.084,2.017,2.558,3.604,4.416,4.765
|
||||
s4.025,1.976,6.507,2.438c2.475,0.466,5.031,0.698,7.665,0.698c6.505,0,11.537-1.082,15.103-3.253
|
||||
c3.561-2.166,6.192-4.762,7.899-7.785c1.702-3.019,2.749-6.072,3.137-9.174c0.384-3.097,0.58-5.576,0.58-7.434V170.93
|
||||
C340.548,172.172,338.806,173.139,336.714,173.837z"/>
|
||||
<path d="M461.826,109.594v22.072h-24.161v59.479c0,5.573,0.928,9.292,2.788,11.149c1.856,1.859,5.576,2.788,11.152,2.788
|
||||
c1.859,0,3.638-0.076,5.343-0.232c1.703-0.152,3.33-0.388,4.878-0.696v25.557c-2.788,0.465-5.887,0.773-9.293,0.931
|
||||
c-3.407,0.149-6.737,0.23-9.99,0.23c-5.111,0-9.953-0.35-14.521-1.048c-4.571-0.695-8.597-2.047-12.081-4.063
|
||||
c-3.486-2.011-6.236-4.88-8.248-8.597c-2.016-3.714-3.021-8.595-3.021-14.639v-70.859h-19.98v-22.072h19.98V73.582h32.992v36.012
|
||||
H461.826z"/>
|
||||
<path d="M508.989,109.594v22.306h0.465c1.546-3.72,3.636-7.163,6.272-10.341c2.634-3.172,5.652-5.885,9.06-8.131
|
||||
c3.405-2.242,7.047-3.985,10.923-5.228c3.868-1.237,7.898-1.859,12.081-1.859c2.168,0,4.566,0.39,7.202,1.163v30.67
|
||||
c-1.551-0.312-3.41-0.584-5.576-0.814c-2.17-0.233-4.26-0.35-6.274-0.35c-6.041,0-11.152,1.01-15.332,3.021
|
||||
c-4.182,2.014-7.55,4.761-10.107,8.247c-2.555,3.487-4.379,7.55-5.462,12.198c-1.083,4.645-1.625,9.682-1.625,15.102v54.133h-32.991
|
||||
V109.594H508.989z"/>
|
||||
<path d="M568.931,91.006V63.823h32.994v27.183H568.931z M601.925,109.594v120.117h-32.994V109.594H601.925z"/>
|
||||
<path d="M619.116,109.594h37.637l21.144,31.365l20.911-31.365h36.476l-39.496,56.226l44.377,63.892h-37.64l-25.093-37.87
|
||||
l-25.094,37.87H615.4l43.213-63.193L619.116,109.594z"/>
|
||||
<path d="M780.444,329.096V7.71h-23.13V0h32.008v336.807h-32.008v-7.711H780.444z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 4.7 KiB |
12
index.html
Normal file
12
index.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>[matrix]</title>
|
||||
<link rel="stylesheet" href="site.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="site"></div>
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
34
package.json
Normal file
34
package.json
Normal file
|
@ -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"
|
||||
}
|
||||
}
|
138
site.css
Normal file
138
site.css
Normal file
|
@ -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 {
|
||||
}
|
27
src/components/Footer.js
Normal file
27
src/components/Footer.js
Normal file
|
@ -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 (
|
||||
<div className="mxt_Footer">
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})
|
27
src/components/Header.js
Normal file
27
src/components/Header.js
Normal file
|
@ -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 (
|
||||
<div className="mxt_Header">
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})
|
362
src/components/HomePage.js
Normal file
362
src/components/HomePage.js
Normal file
|
@ -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 = <div className="mxt_HomePage_error">{ this.state.error }</div>
|
||||
}
|
||||
|
||||
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 = (
|
||||
<div key="links" className="mxt_HomePage_links">
|
||||
<div className="mxt_HomePage_links_intro">
|
||||
<p>
|
||||
Matrix is an ecosystem for open and interoperable communication.
|
||||
</p>
|
||||
<p>
|
||||
To connect to <b>{ this.state.entity }</b>, please select an app:
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{ 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 <div key={ client.name }/>;
|
||||
|
||||
var link = isRoom ? client.room_url + this.state.entity : client.user_url + this.state.entity;
|
||||
return (
|
||||
<div key={ client.name } className="mxt_HomePage_link">
|
||||
<div className="mxt_HomePage_link_logo">
|
||||
<a href={ link }><img src={ client.logo }/></a>
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_name">
|
||||
<a href={ link }>{ client.name }</a>
|
||||
<div className="mxt_HomePage_link_homepage">
|
||||
<a href={ client.homepage }>{ client.homepage }</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_comments">
|
||||
{ client.comments }
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_author">
|
||||
{ client.author }
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_maturity">
|
||||
{ client.maturity }
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_link">
|
||||
<a href={ link }>{ link }</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{ 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 <div key={ client.name } />;
|
||||
|
||||
return (
|
||||
<div key={ client.name } className="mxt_HomePage_link">
|
||||
<div className="mxt_HomePage_link_logo">
|
||||
<a href={ client.homepage }><img src={ client.logo }/></a>
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_name">
|
||||
<a href={ client.homepage }>{ client.name }</a>
|
||||
<div className="mxt_HomePage_link_homepage">
|
||||
<a href={ client.homepage }>{ client.homepage }</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_comments">
|
||||
{ client.comments }
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_author">
|
||||
{ client.author }
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_maturity">
|
||||
{ client.maturity }
|
||||
</div>
|
||||
<div className="mxt_HomePage_link_instructions">
|
||||
{ instructions }
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
<p>
|
||||
To add clients to this list, <a href="https://matrix.to/#/#matrix-dev:matrix.org">please contact us</a> or
|
||||
simply send us a pull request <a href="https://github.com/matrix-org/matrix.to">on github</a>!
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
prompt = [
|
||||
<div key="inputbox" className="mxt_HomePage_inputBox">
|
||||
<a href={ link } className="mxt_HomePage_inputBox_link">{ link }</a>
|
||||
{ error }
|
||||
</div>,
|
||||
links
|
||||
];
|
||||
}
|
||||
else {
|
||||
prompt = [
|
||||
<div key="inputBox" className="mxt_HomePage_inputBox">
|
||||
<form onSubmit={ this.onSubmit }>
|
||||
<input autoFocus className="mxt_HomePage_inputBox_prompt" value={ this.state.entity } ref="prompt" size="36" type="text" value={ this.state.value } placeholder="#room:domain.com or @user:domain.com" />
|
||||
<input className="mxt_HomePage_inputBox_button" type="submit" value="Get link!" />
|
||||
</form>
|
||||
{ error }
|
||||
</div>,
|
||||
<div key="cta" className="mxt_HomePage_cta">
|
||||
Create shareable links to Matrix rooms, users or messages<br/>
|
||||
without being tied to a specific app.
|
||||
</div>
|
||||
];
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mxt_HomePage">
|
||||
<a href="#">
|
||||
<img className="mxt_HomePage_logo" src="img/matrix-logo.svg" width="352" height="150" alt="[matrix]"/>
|
||||
</a>
|
||||
|
||||
{ prompt }
|
||||
|
||||
<div className="mxt_HomePage_info">
|
||||
<h3>About</h3>
|
||||
<p>
|
||||
Matrix.to is a simple stateless URL redirecting service
|
||||
which lets users share links to entities in the <a href="https://matrix.org">Matrix.org
|
||||
</a> 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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
Links are designed to be human-friendly, both for reading and constructing, and are
|
||||
essentially a compatibility step in the journey towards
|
||||
a <a href="https://matrix.org/jira/browse/SPEC-5">ubiquitous mx://</a> URL scheme.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})
|
41
src/components/Site.js
Normal file
41
src/components/Site.js
Normal file
|
@ -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: <HomePage/>,
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="mxt_Site">
|
||||
<Header/>
|
||||
{ this.state.page }
|
||||
<Footer/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})
|
22
src/index.js
Normal file
22
src/index.js
Normal file
|
@ -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(<Site />, document.getElementById('site'))
|
22
webpack.config.js
Normal file
22
webpack.config.js
Normal file
|
@ -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',
|
||||
};
|
Loading…
Reference in a new issue