mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-27 02:52:25 +03:00
small nits
This commit is contained in:
parent
a6a8f24dde
commit
c35bfd4de8
@ -53,13 +53,6 @@ const REJECT_LIST = [
|
||||
"please-dont-use-timeout",
|
||||
];
|
||||
|
||||
export const onMobile = (userAgent) => {
|
||||
if (!userAgent) return;
|
||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
userAgent
|
||||
);
|
||||
};
|
||||
|
||||
export const userRoute = (text) => {
|
||||
if (!USERNAME_REGEX.test(text)) {
|
||||
return false;
|
||||
|
@ -1,7 +1,5 @@
|
||||
const getNavigatorAgent = (userAgent) => {
|
||||
return userAgent
|
||||
? userAgent
|
||||
: navigator.userAgent || navigator.vendor || window.opera;
|
||||
return userAgent ? userAgent : navigator.userAgent || navigator.vendor || window.opera;
|
||||
};
|
||||
|
||||
export const delay = async (waitMs) => {
|
||||
@ -10,8 +8,7 @@ export const delay = async (waitMs) => {
|
||||
|
||||
export const checkIfElementIsVisible = (el) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const windowHeight =
|
||||
window.innerHeight || document.documentElement.clientHeight;
|
||||
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
||||
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
|
||||
const isVisible =
|
||||
@ -75,11 +72,7 @@ export const isDescendant = (parent, child) => {
|
||||
};
|
||||
|
||||
export const getScrollDistance = () => {
|
||||
return (
|
||||
window.pageYOffset ||
|
||||
document.documentElement.scrollTop ||
|
||||
document.body.scrollTop
|
||||
);
|
||||
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
||||
};
|
||||
|
||||
export const isAndroid = (userAgent) => {
|
||||
|
@ -130,9 +130,7 @@ const STYLES_SIDEBAR = css`
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@supports (
|
||||
(-webkit-backdrop-filter: blur(25px)) or (backdrop-filter: blur(25px))
|
||||
) {
|
||||
@supports ((-webkit-backdrop-filter: blur(25px)) or (backdrop-filter: blur(25px))) {
|
||||
-webkit-backdrop-filter: blur(25px);
|
||||
backdrop-filter: blur(25px);
|
||||
background-color: rgba(247, 247, 247, 0.75);
|
||||
@ -190,13 +188,13 @@ export default class ApplicationLayout extends React.Component {
|
||||
|
||||
componentDidMount = () => {
|
||||
this.prevScrollPos = window.pageYOffset;
|
||||
if (Validations.onMobile()) {
|
||||
if (this.props.mobile) {
|
||||
window.addEventListener("scroll", this._handleScroll);
|
||||
}
|
||||
};
|
||||
|
||||
componentWillUnmount = () => {
|
||||
if (Validations.onMobile()) {
|
||||
if (this.props.mobile) {
|
||||
window.removeEventListener("scroll", this._handleScroll);
|
||||
}
|
||||
};
|
||||
|
@ -80,20 +80,6 @@ const STYLES_COPY_INPUT = css`
|
||||
opacity: 0;
|
||||
`;
|
||||
|
||||
const STYLES_ICON_BOX_BACKGROUND = css`
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
cursor: pointer;
|
||||
background-color: rgba(248, 248, 248, 0.6);
|
||||
border-radius: 3px;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
`;
|
||||
|
||||
const STYLES_LOADER = css`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -113,12 +99,13 @@ const STYLES_CONTAINER = css`
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
z-index: ${Constants.zindex.body};
|
||||
overflow: hidden;
|
||||
`;
|
||||
|
||||
const STYLES_CONTAINER_EDITING = css`
|
||||
${STYLES_CONTAINER}
|
||||
background-image: radial-gradient(
|
||||
${Constants.system.border} 10%,
|
||||
${Constants.system.darkGray} 10%,
|
||||
transparent 0
|
||||
);
|
||||
background-size: 30px 30px;
|
||||
@ -162,13 +149,13 @@ const STYLES_ITEM_EDITING = css`
|
||||
`;
|
||||
|
||||
const STYLES_FILE_TAG = css`
|
||||
font-family: ${Constants.font.medium};
|
||||
font-family: ${Constants.font.text};
|
||||
color: ${Constants.system.grayBlack};
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 0 4px;
|
||||
background: ${Constants.system.white};
|
||||
${"" /* border: 1px solid ${Constants.system.lightBorder};
|
||||
border-top: none; */}
|
||||
`;
|
||||
|
||||
const STYLES_FILE_NAME = css`
|
||||
@ -182,7 +169,7 @@ const STYLES_FILE_NAME = css`
|
||||
`;
|
||||
|
||||
const STYLES_FILE_TYPE = css`
|
||||
color: ${Constants.system.grayBlack};
|
||||
color: ${Constants.system.darkGray};
|
||||
text-transform: uppercase;
|
||||
flex-shrink: 0;
|
||||
margin-left: 16px;
|
||||
|
@ -7,7 +7,6 @@ import JWT from "jsonwebtoken";
|
||||
import BCrypt from "bcrypt";
|
||||
|
||||
import { Buckets, PrivateKey, Pow, Client, ThreadID } from "@textile/hub";
|
||||
import { CompressedPixelFormat } from "three";
|
||||
|
||||
const BUCKET_NAME = "data";
|
||||
|
||||
|
@ -3,20 +3,14 @@ import * as Utilities from "~/node_common/utilities";
|
||||
import * as Strings from "~/common/strings";
|
||||
import * as Social from "~/node_common/social";
|
||||
|
||||
import { read } from "fs";
|
||||
|
||||
export default async (req, res) => {
|
||||
if (!req.body.data || !req.body.data.cids || !req.body.data.cids.length) {
|
||||
return res
|
||||
.status(500)
|
||||
.send({ decorator: "SERVER_REMOVE_DATA_NO_CID", error: true });
|
||||
return res.status(500).send({ decorator: "SERVER_REMOVE_DATA_NO_CID", error: true });
|
||||
}
|
||||
|
||||
const id = Utilities.getIdFromCookie(req);
|
||||
if (!id) {
|
||||
return res
|
||||
.status(403)
|
||||
.send({ decorator: "SERVER_REMOVE_DATA_NOT_ALLOWED", error: true });
|
||||
return res.status(403).send({ decorator: "SERVER_REMOVE_DATA_NOT_ALLOWED", error: true });
|
||||
}
|
||||
|
||||
const user = await Data.getUserById({
|
||||
@ -49,9 +43,7 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
if (!r) {
|
||||
return res
|
||||
.status(500)
|
||||
.send({ decorator: "SERVER_REMOVE_MULTIPLE_NO_TEXTILE", error: true });
|
||||
return res.status(500).send({ decorator: "SERVER_REMOVE_MULTIPLE_NO_TEXTILE", error: true });
|
||||
}
|
||||
|
||||
// TODO(jim): Put this call into a file for all Textile related calls.
|
||||
@ -69,9 +61,7 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
if (!items) {
|
||||
return res
|
||||
.status(500)
|
||||
.send({ decorator: "SERVER_REMOVE_MULTIPLE_NO_TEXTILE", error: true });
|
||||
return res.status(500).send({ decorator: "SERVER_REMOVE_MULTIPLE_NO_TEXTILE", error: true });
|
||||
}
|
||||
|
||||
let entities = [];
|
||||
@ -83,9 +73,7 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
if (!entities.length) {
|
||||
return res
|
||||
.status(500)
|
||||
.send({ decorator: "SERVER_REMOVE_DATA_NO_CID", error: true });
|
||||
return res.status(500).send({ decorator: "SERVER_REMOVE_DATA_NO_CID", error: true });
|
||||
}
|
||||
|
||||
let bucketRemoval;
|
||||
|
19
server.js
19
server.js
@ -3,6 +3,7 @@ import * as Validations from "~/common/validations";
|
||||
import * as Data from "~/node_common/data";
|
||||
import * as Utilities from "~/node_common/utilities";
|
||||
import * as Serializers from "~/node_common/serializers";
|
||||
import * as Window from "~/common/window";
|
||||
|
||||
import * as ViewerManager from "~/node_common/managers/viewer";
|
||||
import * as AnalyticsManager from "~/node_common/managers/analytics";
|
||||
@ -31,21 +32,15 @@ app.prepare().then(async () => {
|
||||
const server = express();
|
||||
|
||||
server.use(cors());
|
||||
server.use(
|
||||
morgan(":method :url :status :res[content-length] - :response-time ms")
|
||||
);
|
||||
server.use(morgan(":method :url :status :res[content-length] - :response-time ms"));
|
||||
|
||||
server.use("/public", express.static("public"));
|
||||
server.get("/system", async (r, s) => s.redirect("/_/system"));
|
||||
server.get("/experiences", async (r, s) => s.redirect("/_/system"));
|
||||
server.get("/_/experiences", async (r, s) => s.redirect("/_/system"));
|
||||
server.get("/system/:c", async (r, s) =>
|
||||
s.redirect(`/_/system/${r.params.c}`)
|
||||
);
|
||||
server.get("/system/:c", async (r, s) => s.redirect(`/_/system/${r.params.c}`));
|
||||
|
||||
server.get("/experiences/:m", async (r, s) =>
|
||||
s.redirect(`/_/experiences/${r.params.m}`)
|
||||
);
|
||||
server.get("/experiences/:m", async (r, s) => s.redirect(`/_/experiences/${r.params.m}`));
|
||||
|
||||
server.all("/api/:a", async (r, s, next) => {
|
||||
return handler(r, s, r.url);
|
||||
@ -76,7 +71,7 @@ app.prepare().then(async () => {
|
||||
});
|
||||
|
||||
server.get("/_", async (req, res) => {
|
||||
let mobile = Validations.onMobile(req.headers["user-agent"]);
|
||||
let mobile = Window.isMobileBrowser(req.headers["user-agent"]);
|
||||
|
||||
const isBucketsAvailable = await Utilities.checkTextile();
|
||||
|
||||
@ -120,7 +115,7 @@ app.prepare().then(async () => {
|
||||
server.all("/_/:a/:b", async (r, s) => handler(r, s, r.url));
|
||||
|
||||
server.get("/:username", async (req, res) => {
|
||||
let mobile = Validations.onMobile(req.headers["user-agent"]);
|
||||
let mobile = Window.isMobileBrowser(req.headers["user-agent"]);
|
||||
|
||||
// TODO(jim): Temporary workaround
|
||||
if (!Validations.userRoute(req.params.username)) {
|
||||
@ -161,7 +156,7 @@ app.prepare().then(async () => {
|
||||
});
|
||||
|
||||
server.get("/:username/:slatename", async (req, res) => {
|
||||
let mobile = Validations.onMobile(req.headers["user-agent"]);
|
||||
let mobile = Window.isMobileBrowser(req.headers["user-agent"]);
|
||||
// TODO(jim): Temporary workaround
|
||||
if (!Validations.userRoute(req.params.username)) {
|
||||
return handler(req, res, req.url, { mobile });
|
||||
|
Loading…
Reference in New Issue
Block a user