Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
added DMCA notice to shot page
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Apr 19, 2017
1 parent 3233e57 commit 879ee99
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/db-patches/patch-15-16.sql
@@ -0,0 +1 @@
ALTER TABLE data ADD COLUMN dmca TEXT;
1 change: 1 addition & 0 deletions server/db-patches/patch-16-15.sql
@@ -0,0 +1 @@
ALTER TABLE data DROP COLUMN dmca;
2 changes: 1 addition & 1 deletion server/src/dbschema.js
Expand Up @@ -4,7 +4,7 @@ const pgpatcher = require("pg-patcher");
const path = require("path");
const mozlog = require("mozlog")("dbschema");

const MAX_DB_LEVEL = exports.MAX_DB_LEVEL = 15;
const MAX_DB_LEVEL = exports.MAX_DB_LEVEL = 16;

exports.forceDbVersion = function(version) {
mozlog.info("forcing-db-version", {db: db.constr, version});
Expand Down
2 changes: 2 additions & 0 deletions server/src/pages/shot/model.js
Expand Up @@ -28,6 +28,7 @@ exports.createModel = function(req) {
cspNonce: req.cspNonce,
hashAnalytics: true,
userAgent: req.headers['user-agent'],
dmca: req.shot.dmca,
isMobile
};
let clientPayload = {
Expand All @@ -54,6 +55,7 @@ exports.createModel = function(req) {
defaultExpiration: req.config.defaultExpiration * 1000,
hashAnalytics: true,
userAgent: req.headers['user-agent'],
dmca: req.shot.dmca,
isMobile
};
if (serverPayload.expireTime !== null && Date.now() > serverPayload.expireTime) {
Expand Down
26 changes: 26 additions & 0 deletions server/src/pages/shot/view.js
Expand Up @@ -194,12 +194,38 @@ class Body extends React.Component {
}

render() {
if (this.props.dmca !== null) {
return this.renderDMCA();
}
if (this.props.expireTime !== null && Date.now() > this.props.expireTime) {
return this.renderExpired();
}
return this.renderBody();
}

renderDMCA() {
let moreInfo = null;
if (this.props.isOwner) {
moreInfo = (
<span>
Please email <a href="mailto:dmcanotice@mozilla.com">dmcanotice@mozilla.com</a> to request further information.<br/>
Please include the URL of this shot in your email: {this.props.backend}/{this.props.id}
</span>
);
}
return <reactruntime.BodyTemplate {...this.props}>
<div className="column-center full-height inverse-color-scheme">
<div className="large-icon-message-container">
<div className="large-icon logo" />
<div className="large-icon-message-string">
This shot is no longer available due to an intellectual property claim.<br/>
{ moreInfo }
</div>
</div>
</div>
</reactruntime.BodyTemplate>;
}

renderExpired() {
let expireTime = this.props.expireTime;
if (typeof expireTime != "number") {
Expand Down
6 changes: 4 additions & 2 deletions server/src/servershot.js
Expand Up @@ -370,6 +370,7 @@ Shot.get = function(backend, id, deviceId) {
shot.urlIfDeleted = rawValue.url;
shot.expireTime = rawValue.expireTime;
shot.deleted = rawValue.deleted;
shot.dmca = rawValue.dmca;
return shot;
});
};
Expand Down Expand Up @@ -398,7 +399,7 @@ Shot.getRawValue = function(id, deviceId) {
if (!id) {
throw new Error("Empty id: " + id);
}
let query = `SELECT value, deviceid, url, title, expire_time, deleted FROM data WHERE id = $1`;
let query = `SELECT value, deviceid, url, title, expire_time, deleted, dmca FROM data WHERE id = $1`;
let params = [id];
if (deviceId) {
query += ` AND deviceid = $2`;
Expand All @@ -418,7 +419,8 @@ Shot.getRawValue = function(id, deviceId) {
url: row.url,
title: row.title,
expireTime: row.expire_time,
deleted: row.deleted
deleted: row.deleted,
dmca: row.dmca
};
});
};
Expand Down

0 comments on commit 879ee99

Please sign in to comment.