Fix linkfile redirect
This commit is contained in:
parent
d0d1742203
commit
c6260b9d12
|
@ -1,22 +1,9 @@
|
||||||
/** @jsx jsx */
|
/** @jsx jsx */
|
||||||
import { jsx, Box, Flex } from "theme-ui"
|
import { AppBar, Button, Card, CardContent, Container, Input, Tab, Tabs, Typography } from "@material-ui/core"
|
||||||
import {
|
|
||||||
Container,
|
|
||||||
Card,
|
|
||||||
CardContent,
|
|
||||||
Typography,
|
|
||||||
CardActions,
|
|
||||||
Button,
|
|
||||||
makeStyles,
|
|
||||||
AppBar,
|
|
||||||
Tabs,
|
|
||||||
Tab,
|
|
||||||
Input
|
|
||||||
} from "@material-ui/core"
|
|
||||||
import Dropzone from "../src/components/Dropzone"
|
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
import { Box, Flex, jsx } from "theme-ui"
|
||||||
|
import Dropzone from "../src/components/Dropzone"
|
||||||
import { TabPanel } from "../src/components/TabPanel"
|
import { TabPanel } from "../src/components/TabPanel"
|
||||||
import * as R from "ramda"
|
|
||||||
|
|
||||||
const Index = () => {
|
const Index = () => {
|
||||||
const [value, setValue] = useState(1)
|
const [value, setValue] = useState(1)
|
||||||
|
@ -27,10 +14,8 @@ const Index = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const directView = () => {
|
const directView = () => {
|
||||||
const removeHead = R.compose(R.tail, R.split("sia://"))
|
|
||||||
const hash = removeHead(linkfileUrl)[0]
|
|
||||||
if (window) {
|
if (window) {
|
||||||
var win = window.open(`/direct/${hash}`, "_blank")
|
var win = window.open(`/direct/${linkfileUrl}`, "_blank")
|
||||||
win.focus()
|
win.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +73,7 @@ const Index = () => {
|
||||||
<p>Download a file by pasting in a Sia linkfile below:</p>
|
<p>Download a file by pasting in a Sia linkfile below:</p>
|
||||||
<Box sx={{ width: "60%" }}>
|
<Box sx={{ width: "60%" }}>
|
||||||
<Input
|
<Input
|
||||||
placeholder="sia://"
|
// placeholder="sia://"
|
||||||
value={linkfileUrl}
|
value={linkfileUrl}
|
||||||
onChange={e => setInput(e.target.value)}
|
onChange={e => setInput(e.target.value)}
|
||||||
sx={{ width: "100%" }}
|
sx={{ width: "100%" }}
|
||||||
|
|
Reference in New Issue