Refactor small components

This commit is contained in:
Jeremie Pardou-Piquemal 2022-12-15 22:24:01 +01:00
parent a49db05eb9
commit bbbe0f5e2d
8 changed files with 478 additions and 509 deletions

View File

@ -6,443 +6,429 @@ import { COMMIT_SHA } from '@/config/env';
import apiUrlGenerator from '@/api/generator'; import apiUrlGenerator from '@/api/generator';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
class About extends Component { const About = ({ roomId: roomIdProp }) => {
constructor(props) { const [roomId, setRoomId] = React.useState(roomIdProp);
super(props); const [abuseReported, setAbuseReported] = React.useState(false);
this.state = {
roomId: props.roomId,
abuseReported: false,
};
}
handleUpdateRoomId(evt) { const handleUpdateRoomId = evt => {
this.setState({ setRoomId(evt.target.value);
roomId: evt.target.value, };
});
}
handleReportAbuse(evt) { const handleReportAbuse = evt => {
evt.preventDefault(); evt.preventDefault();
fetch(`${apiUrlGenerator('abuse')}/${this.state.roomId}`, { fetch(`${apiUrlGenerator('abuse')}/${roomId}`, {
method: 'POST', method: 'POST',
}); });
this.setState({ setAbuseReported(true);
abuseReported: true, };
});
}
render() { return (
return ( <div className={styles.base}>
<div className={styles.base}> <div className={styles.links}>
<div className={styles.links}> <div>
<div> <a href="#version">Version</a>
<a href="#version">Version</a>
</div>
<div>
<a href="#software">Software</a>
</div>
<div>
<a href="#report-abuse">Report Abuse</a>
</div>
<div>
<a href="#acceptable-use">Acceptable Use Policy</a>
</div>
<div>
<a href="#disclaimer">Disclaimer</a>
</div>
<div>
<a href="#terms">Terms of Service</a>
</div>
<div>
<a href="#contact">Contact</a>
</div>
<div>
<a href="#donate">Donate</a>
</div>
</div> </div>
<div>
<a href="#software">Software</a>
</div>
<div>
<a href="#report-abuse">Report Abuse</a>
</div>
<div>
<a href="#acceptable-use">Acceptable Use Policy</a>
</div>
<div>
<a href="#disclaimer">Disclaimer</a>
</div>
<div>
<a href="#terms">Terms of Service</a>
</div>
<div>
<a href="#contact">Contact</a>
</div>
<div>
<a href="#donate">Donate</a>
</div>
</div>
<section id="version"> <section id="version">
<h4>Version</h4> <h4>Version</h4>
<p> <p>
Commit SHA:{' '} Commit SHA:{' '}
<a target="_blank" href={`https://github.com/darkwire/darkwire.io/commit/${COMMIT_SHA}`}> <a target="_blank" href={`https://github.com/darkwire/darkwire.io/commit/${COMMIT_SHA}`}>
{COMMIT_SHA} {COMMIT_SHA}
</a> </a>
</p> </p>
</section> </section>
<section id="software"> <section id="software">
<h4>Software</h4> <h4>Software</h4>
<p> <p>
This software uses the{' '} This software uses the{' '}
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Crypto" target="_blank" rel="noopener noreferrer"> <a href="https://developer.mozilla.org/en-US/docs/Web/API/Crypto" target="_blank" rel="noopener noreferrer">
Web Cryptography API Web Cryptography API
</a>{' '} </a>{' '}
to encrypt data which is transferred using{' '} to encrypt data which is transferred using{' '}
<a href="https://en.wikipedia.org/wiki/WebSocket" target="_blank" rel="noopener noreferrer"> <a href="https://en.wikipedia.org/wiki/WebSocket" target="_blank" rel="noopener noreferrer">
secure WebSockets secure WebSockets
</a> </a>
. Messages are never stored on a server or sent over the wire in plain-text. . Messages are never stored on a server or sent over the wire in plain-text.
</p> </p>
<p> <p>
We believe in privacy and transparency. &nbsp; We believe in privacy and transparency. &nbsp;
<a href="https://github.com/darkwire/darkwire.io" target="_blank" rel="noopener noreferrer"> <a href="https://github.com/darkwire/darkwire.io" target="_blank" rel="noopener noreferrer">
View the source code and documentation on GitHub. View the source code and documentation on GitHub.
</a> </a>
</p> </p>
</section> </section>
<section id="report-abuse"> <section id="report-abuse">
<h4>Report Abuse</h4> <h4>Report Abuse</h4>
<p> <p>
We encourage you to report problematic content to us. Please keep in mind that to help ensure the safety, We encourage you to report problematic content to us. Please keep in mind that to help ensure the safety,
confidentiality and security of your messages, we do not have the contents of messages available to us, confidentiality and security of your messages, we do not have the contents of messages available to us, which
which limits our ability to verify the report and take action. limits our ability to verify the report and take action.
</p> </p>
<p> <p>
When needed, you can take a screenshot of the content and share it, along with any available contact info, When needed, you can take a screenshot of the content and share it, along with any available contact info,
with appropriate law enforcement authorities. with appropriate law enforcement authorities.
</p> </p>
<p> <p>
To report any content, email us at abuse[at]darkwire.io or submit the room ID below to report anonymously. To report any content, email us at abuse[at]darkwire.io or submit the room ID below to report anonymously.
</p> </p>
<form onSubmit={this.handleReportAbuse.bind(this)}> <form onSubmit={handleReportAbuse}>
{this.state.abuseReported && <div>Thank you!</div>} {abuseReported && <div>Thank you!</div>}
<div> <div>
<div className="input-group"> <div className="input-group">
<input <input
className="form-control" className="form-control"
placeholder="Room ID" placeholder="Room ID"
onChange={this.handleUpdateRoomId.bind(this)} onChange={handleUpdateRoomId}
value={this.state.roomId} value={roomId}
type="text" type="text"
/> />
<div className="input-group-append"> <div className="input-group-append">
<button className="btn btn-secondary" type="submit"> <button className="btn btn-secondary" type="submit">
Submit Submit
</button> </button>
</div>
</div> </div>
</div> </div>
</form> </div>
<br /> </form>
<p>If you feel you or anyone else is in immediate danger, please contact your local emergency services.</p> <br />
<p> <p>If you feel you or anyone else is in immediate danger, please contact your local emergency services.</p>
If you receive content from someone who wishes to hurt themselves, and you're concerned for their safety, <p>
please contact your local emergency services or a{' '} If you receive content from someone who wishes to hurt themselves, and you're concerned for their safety,
<a href="https://faq.whatsapp.com/en/general/28030010">suicide prevention hotline</a>. please contact your local emergency services or a{' '}
</p> <a href="https://faq.whatsapp.com/en/general/28030010">suicide prevention hotline</a>.
<p> </p>
If you receive or encounter content indicating abuse or exploitation of a child, please contact the{' '} <p>
<a href="http://www.missingkids.com">National Center for Missing and Exploited Children (NCMEC)</a>. If you receive or encounter content indicating abuse or exploitation of a child, please contact the{' '}
</p> <a href="http://www.missingkids.com">National Center for Missing and Exploited Children (NCMEC)</a>.
</section> </p>
</section>
<section id="acceptable-use"> <section id="acceptable-use">
<h4>Acceptable Use Policy</h4> <h4>Acceptable Use Policy</h4>
<p> <p>
This Acceptable Use Policy (this Policy) describes prohibited uses of the web services offered by Darkwire This Acceptable Use Policy (this Policy) describes prohibited uses of the web services offered by Darkwire
and its affiliates (the Services) and the website located at https://darkwire.io (the Darkwire Site). and its affiliates (the Services) and the website located at https://darkwire.io (the Darkwire Site). The
The examples described in this Policy are not exhaustive. We may modify this Policy at any time by posting a examples described in this Policy are not exhaustive. We may modify this Policy at any time by posting a
revised version on the Darkwire Site. By using the Services or accessing the Darkwire Site, you agree to the revised version on the Darkwire Site. By using the Services or accessing the Darkwire Site, you agree to the
latest version of this Policy. If you violate the Policy or authorize or help others to do so, we may latest version of this Policy. If you violate the Policy or authorize or help others to do so, we may suspend
suspend or terminate your use of the Services. or terminate your use of the Services.
</p> </p>
<strong>No Illegal, Harmful, or Offensive Use or Content</strong> <strong>No Illegal, Harmful, or Offensive Use or Content</strong>
<p> <p>
You may not use, or encourage, promote, facilitate or instruct others to use, the Services or Darkwire Site You may not use, or encourage, promote, facilitate or instruct others to use, the Services or Darkwire Site
for any illegal, harmful, fraudulent, infringing or offensive use, or to transmit, store, display, for any illegal, harmful, fraudulent, infringing or offensive use, or to transmit, store, display, distribute
distribute or otherwise make available content that is illegal, harmful, fraudulent, infringing or or otherwise make available content that is illegal, harmful, fraudulent, infringing or offensive. Prohibited
offensive. Prohibited activities or content include: activities or content include:
</p> </p>
<ul> <ul>
<li> <li>
<strong>Illegal, Harmful or Fraudulent Activities.</strong> Any activities that are illegal, that violate <strong>Illegal, Harmful or Fraudulent Activities.</strong> Any activities that are illegal, that violate
the rights of others, or that may be harmful to others, our operations or reputation, including the rights of others, or that may be harmful to others, our operations or reputation, including
disseminating, promoting or facilitating child pornography, offering or disseminating fraudulent goods, disseminating, promoting or facilitating child pornography, offering or disseminating fraudulent goods,
services, schemes, or promotions, make-money-fast schemes, ponzi and pyramid schemes, phishing, or services, schemes, or promotions, make-money-fast schemes, ponzi and pyramid schemes, phishing, or pharming.
pharming. </li>
</li>
<li> <li>
<strong>Infringing Content.</strong> Content that infringes or misappropriates the intellectual property <strong>Infringing Content.</strong> Content that infringes or misappropriates the intellectual property or
or proprietary rights of others. proprietary rights of others.
</li> </li>
<li> <li>
<strong>Offensive Content.</strong> Content that is defamatory, obscene, abusive, invasive of privacy, or <strong>Offensive Content.</strong> Content that is defamatory, obscene, abusive, invasive of privacy, or
otherwise objectionable, including content that constitutes child pornography, relates to bestiality, or otherwise objectionable, including content that constitutes child pornography, relates to bestiality, or
depicts non-consensual sex acts. depicts non-consensual sex acts.
</li> </li>
<li> <li>
<strong>Harmful Content.</strong> Content or other computer technology that may damage, interfere with, <strong>Harmful Content.</strong> Content or other computer technology that may damage, interfere with,
surreptitiously intercept, or expropriate any system, program, or data, including viruses, Trojan horses, surreptitiously intercept, or expropriate any system, program, or data, including viruses, Trojan horses,
worms, time bombs, or cancelbots. worms, time bombs, or cancelbots.
</li> </li>
</ul> </ul>
<strong>No Security Violations</strong> <strong>No Security Violations</strong>
<br /> <br />
You may not use the Services to violate the security or integrity of any network, computer or communications You may not use the Services to violate the security or integrity of any network, computer or communications
system, software application, or network or computing device (each, a System). Prohibited activities system, software application, or network or computing device (each, a System). Prohibited activities include:
include: <ul>
<ul> <li>
<li> <strong>Unauthorized Access.</strong> Accessing or using any System without permission, including attempting
<strong>Unauthorized Access.</strong> Accessing or using any System without permission, including to probe, scan, or test the vulnerability of a System or to breach any security or authentication measures
attempting to probe, scan, or test the vulnerability of a System or to breach any security or used by a System.
authentication measures used by a System. </li>
</li>
<li> <li>
<strong>Interception.</strong> Monitoring of data or traffic on a System without permission. <strong>Interception.</strong> Monitoring of data or traffic on a System without permission.
</li> </li>
<li> <li>
<strong>Falsification of Origin.</strong> Forging TCP-IP packet headers, e-mail headers, or any part of a <strong>Falsification of Origin.</strong> Forging TCP-IP packet headers, e-mail headers, or any part of a
message describing its origin or route. The legitimate use of aliases and anonymous remailers is not message describing its origin or route. The legitimate use of aliases and anonymous remailers is not
prohibited by this provision. prohibited by this provision.
</li> </li>
</ul> </ul>
<strong>No Network Abuse</strong> <strong>No Network Abuse</strong>
<br /> <br />
You may not make network connections to any users, hosts, or networks unless you have permission to You may not make network connections to any users, hosts, or networks unless you have permission to communicate
communicate with them. Prohibited activities include: with them. Prohibited activities include:
<ul> <ul>
<li> <li>
<strong>Monitoring or Crawling.</strong> Monitoring or crawling of a System that impairs or disrupts the <strong>Monitoring or Crawling.</strong> Monitoring or crawling of a System that impairs or disrupts the
System being monitored or crawled. System being monitored or crawled.
</li> </li>
<li> <li>
<strong>Denial of Service (DoS).</strong> Inundating a target with communications requests so the target <strong>Denial of Service (DoS).</strong> Inundating a target with communications requests so the target
either cannot respond to legitimate traffic or responds so slowly that it becomes ineffective. either cannot respond to legitimate traffic or responds so slowly that it becomes ineffective.
</li> </li>
<li> <li>
<strong>Intentional Interference.</strong> Interfering with the proper functioning of any System, <strong>Intentional Interference.</strong> Interfering with the proper functioning of any System, including
including any deliberate attempt to overload a system by mail bombing, news bombing, broadcast attacks, or any deliberate attempt to overload a system by mail bombing, news bombing, broadcast attacks, or flooding
flooding techniques. techniques.
</li> </li>
<li> <li>
<strong>Operation of Certain Network Services.</strong> Operating network services like open proxies, open <strong>Operation of Certain Network Services.</strong> Operating network services like open proxies, open
mail relays, or open recursive domain name servers. mail relays, or open recursive domain name servers.
</li> </li>
<li> <li>
<strong>Avoiding System Restrictions.</strong> Using manual or electronic means to avoid any use <strong>Avoiding System Restrictions.</strong> Using manual or electronic means to avoid any use limitations
limitations placed on a System, such as access and storage restrictions. placed on a System, such as access and storage restrictions.
</li> </li>
</ul> </ul>
<strong>No E-Mail or Other Message Abuse</strong> <strong>No E-Mail or Other Message Abuse</strong>
<br /> <br />
You will not distribute, publish, send, or facilitate the sending of unsolicited mass e-mail or other You will not distribute, publish, send, or facilitate the sending of unsolicited mass e-mail or other messages,
messages, promotions, advertising, or solicitations (like spam), including commercial advertising and promotions, advertising, or solicitations (like spam), including commercial advertising and informational
informational announcements. You will not alter or obscure mail headers or assume a senders identity without announcements. You will not alter or obscure mail headers or assume a senders identity without the senders
the senders explicit permission. You will not collect replies to messages sent from another internet service explicit permission. You will not collect replies to messages sent from another internet service provider if
provider if those messages violate this Policy or the acceptable use policy of that provider. those messages violate this Policy or the acceptable use policy of that provider.
<strong>Our Monitoring and Enforcement</strong> <strong>Our Monitoring and Enforcement</strong>
<br /> <br />
We reserve the right, but do not assume the obligation, to investigate any violation of this Policy or misuse We reserve the right, but do not assume the obligation, to investigate any violation of this Policy or misuse of
of the Services or Darkwire Site. We may: the Services or Darkwire Site. We may:
<ul> <ul>
<li>investigate violations of this Policy or misuse of the Services or Darkwire Site; or</li> <li>investigate violations of this Policy or misuse of the Services or Darkwire Site; or</li>
<li> <li>
remove, disable access to, or modify any content or resource that violates this Policy or any other remove, disable access to, or modify any content or resource that violates this Policy or any other
agreement we have with you for use of the Services or the Darkwire Site. agreement we have with you for use of the Services or the Darkwire Site.
</li> </li>
<li> <li>
We may report any activity that we suspect violates any law or regulation to appropriate law enforcement We may report any activity that we suspect violates any law or regulation to appropriate law enforcement
officials, regulators, or other appropriate third parties. Our reporting may include disclosing officials, regulators, or other appropriate third parties. Our reporting may include disclosing appropriate
appropriate customer information. We also may cooperate with appropriate law enforcement agencies, customer information. We also may cooperate with appropriate law enforcement agencies, regulators, or other
regulators, or other appropriate third parties to help with the investigation and prosecution of illegal appropriate third parties to help with the investigation and prosecution of illegal conduct by providing
conduct by providing network and systems information related to alleged violations of this Policy. network and systems information related to alleged violations of this Policy.
</li> </li>
</ul> </ul>
Reporting of Violations of this Policy Reporting of Violations of this Policy
<br /> <br />
If you become aware of any violation of this Policy, you will immediately notify us and provide us with If you become aware of any violation of this Policy, you will immediately notify us and provide us with
assistance, as requested, to stop or remedy the violation. To report any violation of this Policy, please assistance, as requested, to stop or remedy the violation. To report any violation of this Policy, please follow
follow our abuse reporting process. our abuse reporting process.
</section> </section>
<section id="terms"> <section id="terms">
<h4>Terms of Service ("Terms")</h4> <h4>Terms of Service ("Terms")</h4>
<p>Last updated: December 11, 2017</p> <p>Last updated: December 11, 2017</p>
<p> <p>
Please read these Terms of Service ("Terms", "Terms of Service") carefully before using the Please read these Terms of Service ("Terms", "Terms of Service") carefully before using the
https://darkwire.io website (the "Service") operated by Darkwire ("us", "we", or "our"). https://darkwire.io website (the "Service") operated by Darkwire ("us", "we", or "our").
</p> </p>
<p> <p>
Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms. Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms.
These Terms apply to all visitors, users and others who access or use the Service. These Terms apply to all visitors, users and others who access or use the Service.
</p> </p>
<p> <p>
By accessing or using the Service you agree to be bound by these Terms. If you disagree with any part of the By accessing or using the Service you agree to be bound by these Terms. If you disagree with any part of the
terms then you may not access the Service. terms then you may not access the Service.
</p> </p>
<strong>Links To Other Web Sites</strong> <strong>Links To Other Web Sites</strong>
<p> <p>
Our Service may contain links to third-party web sites or services that are not owned or controlled by Our Service may contain links to third-party web sites or services that are not owned or controlled by
Darkwire. Darkwire.
</p> </p>
<p> <p>
Darkwire has no control over, and assumes no responsibility for, the content, privacy policies, or practices Darkwire has no control over, and assumes no responsibility for, the content, privacy policies, or practices
of any third party web sites or services. You further acknowledge and agree that Darkwire shall not be of any third party web sites or services. You further acknowledge and agree that Darkwire shall not be
responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in
in connection with use of or reliance on any such content, goods or services available on or through any connection with use of or reliance on any such content, goods or services available on or through any such web
such web sites or services. sites or services.
</p> </p>
<p> <p>
We strongly advise you to read the terms and conditions and privacy policies of any third-party web sites or We strongly advise you to read the terms and conditions and privacy policies of any third-party web sites or
services that you visit. services that you visit.
</p> </p>
<strong>Termination</strong> <strong>Termination</strong>
<p> <p>
We may terminate or suspend access to our Service immediately, without prior notice or liability, for any We may terminate or suspend access to our Service immediately, without prior notice or liability, for any
reason whatsoever, including without limitation if you breach the Terms. reason whatsoever, including without limitation if you breach the Terms.
</p> </p>
<p> <p>
All provisions of the Terms which by their nature should survive termination shall survive termination, All provisions of the Terms which by their nature should survive termination shall survive termination,
including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of
liability. liability.
</p> </p>
<strong>Governing Law</strong> <strong>Governing Law</strong>
<p> <p>
These Terms shall be governed and construed in accordance with the laws of New York, United States, without These Terms shall be governed and construed in accordance with the laws of New York, United States, without
regard to its conflict of law provisions. regard to its conflict of law provisions.
</p> </p>
<p> <p>
Our failure to enforce any right or provision of these Terms will not be considered a waiver of those Our failure to enforce any right or provision of these Terms will not be considered a waiver of those rights.
rights. If any provision of these Terms is held to be invalid or unenforceable by a court, the remaining If any provision of these Terms is held to be invalid or unenforceable by a court, the remaining provisions of
provisions of these Terms will remain in effect. These Terms constitute the entire agreement between us these Terms will remain in effect. These Terms constitute the entire agreement between us regarding our
regarding our Service, and supersede and replace any prior agreements we might have between us regarding the Service, and supersede and replace any prior agreements we might have between us regarding the Service.
Service. </p>
</p> </section>
</section>
<section id="disclaimer"> <section id="disclaimer">
<h4>Disclaimer</h4> <h4>Disclaimer</h4>
<p className="bold"> <p className="bold">
WARNING: Darkwire does not mask IP addresses nor can verify the integrity of parties recieving messages. WARNING: Darkwire does not mask IP addresses nor can verify the integrity of parties recieving messages.
&nbsp;Proceed with caution and always confirm recipients beforre starting a chat session. &nbsp;Proceed with caution and always confirm recipients beforre starting a chat session.
</p> </p>
<p> <p>
Please also note that <strong>ALL CHATROOMS</strong> are public. &nbsp;Anyone can guess your room URL. If Please also note that <strong>ALL CHATROOMS</strong> are public. &nbsp;Anyone can guess your room URL. If you
you need a more-private room, use the lock feature or set the URL manually by entering a room ID after need a more-private room, use the lock feature or set the URL manually by entering a room ID after
&quot;darkwire.io/&quot;. &quot;darkwire.io/&quot;.
</p> </p>
<br /> <br />
<strong>No Warranties; Exclusion of Liability; Indemnification</strong> <strong>No Warranties; Exclusion of Liability; Indemnification</strong>
<p> <p>
<strong> <strong>
OUR WEBSITE IS OPERATED BY Darkwire ON AN "AS IS," "AS AVAILABLE" BASIS, WITHOUT REPRESENTATIONS OR OUR WEBSITE IS OPERATED BY Darkwire ON AN "AS IS," "AS AVAILABLE" BASIS, WITHOUT REPRESENTATIONS OR
WARRANTIES OF ANY KIND. TO THE FULLEST EXTENT PERMITTED BY LAW, Darkwire SPECIFICALLY DISCLAIMS ALL WARRANTIES OF ANY KIND. TO THE FULLEST EXTENT PERMITTED BY LAW, Darkwire SPECIFICALLY DISCLAIMS ALL
WARRANTIES AND CONDITIONS OF ANY KIND, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, WARRANTIES AND CONDITIONS OF ANY KIND, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT FOR OUR WEBSITE AND ANY CONTRACTS AND SERVICES FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT FOR OUR WEBSITE AND ANY CONTRACTS AND SERVICES
YOU PURCHASE THROUGH IT. Darkwire SHALL NOT HAVE ANY LIABILITY OR RESPONSIBILITY FOR ANY ERRORS OR YOU PURCHASE THROUGH IT. Darkwire SHALL NOT HAVE ANY LIABILITY OR RESPONSIBILITY FOR ANY ERRORS OR OMISSIONS
OMISSIONS IN THE CONTENT OF OUR WEBSITE, FOR CONTRACTS OR SERVICES SOLD THROUGH OUR WEBSITE, FOR YOUR IN THE CONTENT OF OUR WEBSITE, FOR CONTRACTS OR SERVICES SOLD THROUGH OUR WEBSITE, FOR YOUR ACTION OR
ACTION OR INACTION IN CONNECTION WITH OUR WEBSITE OR FOR ANY DAMAGE TO YOUR COMPUTER OR DATA OR ANY OTHER INACTION IN CONNECTION WITH OUR WEBSITE OR FOR ANY DAMAGE TO YOUR COMPUTER OR DATA OR ANY OTHER DAMAGE YOU
DAMAGE YOU MAY INCUR IN CONNECTION WITH OUR WEBSITE. YOUR USE OF OUR WEBSITE AND ANY CONTRACTS OR SERVICES MAY INCUR IN CONNECTION WITH OUR WEBSITE. YOUR USE OF OUR WEBSITE AND ANY CONTRACTS OR SERVICES ARE AT YOUR
ARE AT YOUR OWN RISK. IN NO EVENT SHALL EITHER Darkwire OR THEIR AGENTS BE LIABLE FOR ANY DIRECT, OWN RISK. IN NO EVENT SHALL EITHER Darkwire OR THEIR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE,
INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN ANY WAY CONNECTED INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OUR
WITH THE USE OF OUR WEBSITE, CONTRACTS AND SERVICES PURCHASED THROUGH OUR WEBSITE, THE DELAY OR INABILITY WEBSITE, CONTRACTS AND SERVICES PURCHASED THROUGH OUR WEBSITE, THE DELAY OR INABILITY TO USE OUR WEBSITE OR
TO USE OUR WEBSITE OR OTHERWISE ARISING IN CONNECTION WITH OUR WEBSITE, CONTRACTS OR RELATED SERVICES, OTHERWISE ARISING IN CONNECTION WITH OUR WEBSITE, CONTRACTS OR RELATED SERVICES, WHETHER BASED ON CONTRACT,
WHETHER BASED ON CONTRACT, TORT, STRICT LIABILITY OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF ANY TORT, STRICT LIABILITY OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF ANY SUCH DAMAGES. IN NO EVENT
SUCH DAMAGES. IN NO EVENT SHALL Darkwires LIABILITY FOR ANY DAMAGE CLAIM EXCEED THE AMOUNT PAID BY YOU TO SHALL Darkwires LIABILITY FOR ANY DAMAGE CLAIM EXCEED THE AMOUNT PAID BY YOU TO Darkwire FOR THE
Darkwire FOR THE TRANSACTION GIVING RISE TO SUCH DAMAGE CLAIM. TRANSACTION GIVING RISE TO SUCH DAMAGE CLAIM.
</strong> </strong>
</p> </p>
<p> <p>
<strong> <strong>
SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
ABOVE EXCLUSION MAY NOT APPLY TO YOU. ABOVE EXCLUSION MAY NOT APPLY TO YOU.
</strong> </strong>
</p> </p>
<p> <p>
<strong> <strong>
WITHOUT LIMITING THE FOREGOING, Darkwire DO NOT REPRESENT OR WARRANT THAT THE INFORMATION ON THE WEBITE IS WITHOUT LIMITING THE FOREGOING, Darkwire DO NOT REPRESENT OR WARRANT THAT THE INFORMATION ON THE WEBITE IS
ACCURATE, COMPLETE, RELIABLE, USEFUL, TIMELY OR CURRENT OR THAT OUR WEBSITE WILL OPERATE WITHOUT ACCURATE, COMPLETE, RELIABLE, USEFUL, TIMELY OR CURRENT OR THAT OUR WEBSITE WILL OPERATE WITHOUT
INTERRUPTION OR ERROR. INTERRUPTION OR ERROR.
</strong> </strong>
</p> </p>
<p> <p>
<strong> <strong>
YOU AGREE THAT ALL TIMES, YOU WILL LOOK TO ATTORNEYS FROM WHOM YOU PURCHASE SERVICES FOR ANY CLAIMS OF ANY YOU AGREE THAT ALL TIMES, YOU WILL LOOK TO ATTORNEYS FROM WHOM YOU PURCHASE SERVICES FOR ANY CLAIMS OF ANY
NATURE, INCLUDING LOSS, DAMAGE, OR WARRANTY. Darkwire AND THEIR RESPECTIVE AFFILIATES MAKE NO NATURE, INCLUDING LOSS, DAMAGE, OR WARRANTY. Darkwire AND THEIR RESPECTIVE AFFILIATES MAKE NO REPRESENTATION
REPRESENTATION OR GUARANTEES ABOUT ANY CONTRACTS AND SERVICES OFFERED THROUGH OUR WEBSITE. OR GUARANTEES ABOUT ANY CONTRACTS AND SERVICES OFFERED THROUGH OUR WEBSITE.
</strong> </strong>
</p> </p>
<p> <p>
<strong> <strong>
Darkwire MAKES NO REPRESENTATION THAT CONTENT PROVIDED ON OUR WEBSITE, CONTRACTS, OR RELATED SERVICES ARE Darkwire MAKES NO REPRESENTATION THAT CONTENT PROVIDED ON OUR WEBSITE, CONTRACTS, OR RELATED SERVICES ARE
APPLICABLE OR APPROPRIATE FOR USE IN ALL JURISDICTIONS. APPLICABLE OR APPROPRIATE FOR USE IN ALL JURISDICTIONS.
</strong> </strong>
</p> </p>
<strong>Indemnification</strong> <strong>Indemnification</strong>
<p> <p>
You agree to defend, indemnify and hold Darkwire harmless from and against any and all claims, damages, You agree to defend, indemnify and hold Darkwire harmless from and against any and all claims, damages, costs
costs and expenses, including attorneys' fees, arising from or related to your use of our Website or any and expenses, including attorneys' fees, arising from or related to your use of our Website or any Contracts
Contracts or Services you purchase through it. or Services you purchase through it.
</p> </p>
<strong>Changes</strong> <strong>Changes</strong>
<p> <p>
We reserve the right, at our sole discretion, to modify or replace these Terms at any time. If a revision is We reserve the right, at our sole discretion, to modify or replace these Terms at any time. If a revision is
material we will try to provide at least 30 days notice prior to any new terms taking effect. What material we will try to provide at least 30 days notice prior to any new terms taking effect. What constitutes
constitutes a material change will be determined at our sole discretion. a material change will be determined at our sole discretion.
</p> </p>
<p> <p>
By continuing to access or use our Service after those revisions become effective, you agree to be bound by By continuing to access or use our Service after those revisions become effective, you agree to be bound by
the revised terms. If you do not agree to the new terms, please stop using the Service. the revised terms. If you do not agree to the new terms, please stop using the Service.
</p> </p>
<strong>Contact Us</strong> <strong>Contact Us</strong>
<p>If you have any questions about these Terms, please contact us at hello[at]darkwire.io.</p> <p>If you have any questions about these Terms, please contact us at hello[at]darkwire.io.</p>
</section> </section>
<section id="contact"> <section id="contact">
<h4>Contact</h4> <h4>Contact</h4>
<p>Questions/comments? Email us at hello[at]darkwire.io</p> <p>Questions/comments? Email us at hello[at]darkwire.io</p>
<p> <p>
Found a bug or want a new feature?{' '} Found a bug or want a new feature?{' '}
<a href="https://github.com/darkwire/darkwire.io/issues" target="_blank" rel="noopener noreferrer"> <a href="https://github.com/darkwire/darkwire.io/issues" target="_blank" rel="noopener noreferrer">
Open a ticket on Github Open a ticket on Github
</a> </a>
. .
</p> </p>
</section> </section>
<section id="donate"> <section id="donate">
<h4>Donate</h4> <h4>Donate</h4>
<p> <p>
Darkwire is maintained and hosted by two developers with full-time jobs. If you get some value from this Darkwire is maintained and hosted by two developers with full-time jobs. If you get some value from this
service we would appreciate any donation you can afford. We use these funds for server and DNS costs. Thank service we would appreciate any donation you can afford. We use these funds for server and DNS costs. Thank
you! you!
</p> </p>
<strong>Bitcoin</strong> <strong>Bitcoin</strong>
<p>189sPnHGcjP5uteg2UuNgcJ5eoaRAP4Bw4</p> <p>189sPnHGcjP5uteg2UuNgcJ5eoaRAP4Bw4</p>
<strong>Ethereum</strong> <strong>Ethereum</strong>
<p>0x36dc407bB28aA1EE6AafBee0379Fe6Cff881758E</p> <p>0x36dc407bB28aA1EE6AafBee0379Fe6Cff881758E</p>
<strong>Litecoin</strong> <strong>Litecoin</strong>
<p>LUViQeSggBBtYoN2qNtXSuxYoRMzRY8CSX</p> <p>LUViQeSggBBtYoN2qNtXSuxYoRMzRY8CSX</p>
<strong>PayPal:</strong> <strong>PayPal:</strong>
<br /> <br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="UAH5BCLA9Y8VW" /> <input type="hidden" name="hosted_button_id" value="UAH5BCLA9Y8VW" />
<input <input
type="image" type="image"
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
border="0" border="0"
name="submit" name="submit"
alt="PayPal - The safer, easier way to pay online!" alt="PayPal - The safer, easier way to pay online!"
/> />
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" /> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form> </form>
</section> </section>
</div> </div>
); );
} };
}
About.propTypes = { About.propTypes = {
roomId: PropTypes.string.isRequired, roomId: PropTypes.string.isRequired,

View File

@ -1,7 +1,5 @@
import React, { Component } from 'react'; const Connecting = () => {
return <div>Please wait while we secure a connection to Darkwire...</div>;
};
export default class Connecting extends Component { export default Connecting;
render() {
return <div>Please wait while we secure a connection to Darkwire...</div>;
}
}

View File

@ -316,7 +316,7 @@ const User = ({ createUser, username, ...rest }) => {
setLoaded(true); setLoaded(true);
}; };
if (!loaded && !loading.current) { if (!loaded) {
loading.current = true; loading.current = true;
createUserLocal(); createUserLocal();
} }

View File

@ -1,34 +1,31 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import moment from 'moment'; import moment from 'moment';
import Linkify from 'react-linkify'; import Linkify from 'react-linkify';
import Username from '@/components/Username'; import Username from '@/components/Username';
class Message extends Component { const Message = ({ message, timestamp, sender }) => {
render() { const msg = decodeURI(message);
const msg = decodeURI(this.props.message);
return ( return (
<div> <div>
<div className="chat-meta"> <div className="chat-meta">
<Username username={this.props.sender} /> <Username username={sender} />
<span className="muted timestamp">{moment(this.props.timestamp).format('LT')}</span> <span className="muted timestamp">{moment(timestamp).format('LT')}</span>
</div>
<div className="chat">
<Linkify
properties={{
target: '_blank',
rel: 'noopener noreferrer',
}}
>
{msg}
</Linkify>
</div>
</div> </div>
); <div className="chat">
} <Linkify
} properties={{
target: '_blank',
rel: 'noopener noreferrer',
}}
>
{msg}
</Linkify>
</div>
</div>
);
};
Message.propTypes = { Message.propTypes = {
sender: PropTypes.string.isRequired, sender: PropTypes.string.isRequired,

View File

@ -4,15 +4,10 @@ import { Copy } from 'react-feather';
import Clipboard from 'clipboard'; import Clipboard from 'clipboard';
import $ from 'jquery'; import $ from 'jquery';
class RoomLink extends Component { const RoomLink = ({ roomId, translations }) => {
constructor(props) { const roomUrl = `${window.location.origin}/${roomId}`;
super(props);
this.state = {
roomUrl: `${window.location.origin}/${props.roomId}`,
};
}
componentDidMount() { React.useEffect(() => {
const clip = new Clipboard('.copy-room'); const clip = new Clipboard('.copy-room');
clip.on('success', () => { clip.on('success', () => {
@ -27,36 +22,34 @@ class RoomLink extends Component {
trigger: 'manual', trigger: 'manual',
}); });
}); });
}
componentWillUnmount() { return () => {
if ($('.copy-room').tooltip) $('.copy-room').tooltip('hide'); if ($('.copy-room').tooltip) $('.copy-room').tooltip('hide');
} };
}, []);
render() { return (
return ( <form>
<form> <div className="form-group">
<div className="form-group"> <div className="input-group">
<div className="input-group"> <input id="room-url" className="form-control" type="text" readOnly value={roomUrl} />
<input id="room-url" className="form-control" type="text" readOnly value={this.state.roomUrl} /> <div className="input-group-append">
<div className="input-group-append"> <button
<button className="copy-room btn btn-secondary"
className="copy-room btn btn-secondary" type="button"
type="button" data-toggle="tooltip"
data-toggle="tooltip" data-placement="bottom"
data-placement="bottom" data-clipboard-text={roomUrl}
data-clipboard-text={this.state.roomUrl} title={translations.copyButtonTooltip}
title={this.props.translations.copyButtonTooltip} >
> <Copy />
<Copy /> </button>
</button>
</div>
</div> </div>
</div> </div>
</form> </div>
); </form>
} );
} };
RoomLink.propTypes = { RoomLink.propTypes = {
roomId: PropTypes.string.isRequired, roomId: PropTypes.string.isRequired,

View File

@ -1,7 +1,5 @@
import React, { Component } from 'react'; const RoomLocked = ({ modalContent }) => {
return <div>{modalContent}</div>;
};
export default class RoomLocked extends Component { export default RoomLocked;
render() {
return <div>{this.props.modalContent}</div>;
}
}

View File

@ -1,4 +1,3 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import _ from 'lodash'; import _ from 'lodash';
@ -6,24 +5,25 @@ import { getTranslations } from '@/i18n';
const regex = /{(.*?)}/g; const regex = /{(.*?)}/g;
class T extends Component { const T = ({ language, path, data }) => {
render() { const t = getTranslations(language);
const t = getTranslations(this.props.language); const englishT = getTranslations('en');
const englishT = getTranslations('en'); const str = _.get(t, path, '') || _.get(englishT, path, '');
const str = _.get(t, this.props.path, '') || _.get(englishT, this.props.path, '');
let string = str.split(regex); let string = str.split(regex);
if (this.props.data) {
string = string.map(word => { // Data for string interpolation
if (this.props.data[word]) { if (data) {
return this.props.data[word]; string = string.map(word => {
} if (data[word]) {
return word; return data[word];
}); }
return <span>{string}</span>; return word;
} });
return string; return <span>{string}</span>;
} }
} return string;
};
T.propTypes = { T.propTypes = {
path: PropTypes.string.isRequired, path: PropTypes.string.isRequired,

View File

@ -1,16 +1,13 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import randomColor from 'randomcolor'; import randomColor from 'randomcolor';
class Username extends Component { const Username = ({ username }) => {
render() { return (
return ( <span className="username" style={{ color: randomColor({ seed: username, luminosity: 'light' }) }}>
<span className="username" style={{ color: randomColor({ seed: this.props.username, luminosity: 'light' }) }}> {username}
{this.props.username} </span>
</span> );
); };
}
}
Username.propTypes = { Username.propTypes = {
username: PropTypes.string.isRequired, username: PropTypes.string.isRequired,