From a341a4558b4553dfafe361422fc4797ffbca11e1 Mon Sep 17 00:00:00 2001
From: HFO4 <912394456@qq.com>
Date: Wed, 3 Apr 2019 19:47:26 +0800
Subject: [PATCH] init
---
.gitignore | 21 +
.travis.yml | 8 +
LICENSE | 21 +
README.md | 10 +
config/env.js | 93 +
config/jest/cssTransform.js | 14 +
config/jest/fileTransform.js | 30 +
config/paths.js | 57 +
config/webpack.config.dev.js | 463 +
config/webpack.config.prod.js | 714 +
config/webpackDevServer.config.js | 105 +
package-lock.json | 16277 ++++++++++++++++++++
package.json | 126 +
public/explore/result.html | 47 +
public/favicon.ico | Bin 0 -> 3870 bytes
public/fileShare.html | 60 +
public/folderShare.html | 60 +
public/home/download.html | 44 +
public/home/home.html | 94 +
public/index.html | 65 +
public/lock.html | 60 +
public/manifest.json | 15 +
public/markdown.html | 60 +
public/member/login.html | 69 +
public/member/setting.html | 54 +
public/myShare.html | 60 +
public/profile.html | 60 +
public/profile/profile.html | 79 +
public/setting.html | 60 +
public/share/share_dir.html | 93 +
public/share/share_home.html | 68 +
public/share/share_lock.html | 74 +
public/share/share_single.html | 93 +
public/video.html | 60 +
public/viewer/markdown.html | 74 +
public/viewer/video.html | 70 +
scripts/build.js | 189 +
scripts/start.js | 116 +
scripts/test.js | 53 +
src/App.js | 52 +
src/App.test.js | 9 +
src/actions/index.js | 193 +
src/component/Download.js | 355 +
src/component/FileManager/ContextMenu.js | 341 +
src/component/FileManager/Explorer.js | 271 +
src/component/FileManager/FileIcon.js | 345 +
src/component/FileManager/FileManager.js | 30 +
src/component/FileManager/Folder.js | 130 +
src/component/FileManager/ImgPreview.js | 131 +
src/component/FileManager/Modals.js | 720 +
src/component/FileManager/Navigator.js | 464 +
src/component/FileManager/ObjectIcon.js | 215 +
src/component/FileManager/PathSelector.js | 157 +
src/component/FileManager/SmallIcon.js | 257 +
src/component/FileManager/TableRow.js | 232 +
src/component/LockedFile.js | 140 +
src/component/Login/EmailActivication.js | 113 +
src/component/Login/LoginForm.js | 216 +
src/component/Login/RegisterForm.js | 258 +
src/component/Login/ResetPwd.js | 200 +
src/component/Login/ResetPwdForm.js | 191 +
src/component/Login/TwoStep.js | 160 +
src/component/MyShare.js | 270 +
src/component/Navbar.js | 678 +
src/component/Profile.js | 253 +
src/component/Search.js | 120 +
src/component/SearchBar.js | 180 +
src/component/SharedFile.js | 178 +
src/component/SideDrawer.js | 98 +
src/component/Snackbar.js | 150 +
src/component/StorageBar.js | 153 +
src/component/Upload/FileList.js | 253 +
src/component/Uploader.js | 163 +
src/component/UserAvatar.js | 189 +
src/component/UserInfo.js | 89 +
src/component/UserSetting.js | 775 +
src/component/Viewer/markdown.js | 159 +
src/component/Viewer/video.js | 43 +
src/config.js | 44 +
src/index.js | 75 +
src/loader/index.js | 131 +
src/loader/utils.js | 104 +
src/pages/download.app.js | 48 +
src/pages/download.js | 66 +
src/pages/fileShare.app.js | 48 +
src/pages/fileShare.js | 66 +
src/pages/folderShare.app.js | 51 +
src/pages/folderShare.js | 67 +
src/pages/lock.app.js | 48 +
src/pages/lock.js | 66 +
src/pages/login.app.js | 59 +
src/pages/login.js | 66 +
src/pages/markdown.app.js | 51 +
src/pages/markdown.js | 66 +
src/pages/myShare.app.js | 48 +
src/pages/myShare.js | 66 +
src/pages/profile.app.js | 48 +
src/pages/profile.js | 66 +
src/pages/search.app.js | 48 +
src/pages/search.js | 66 +
src/pages/setting.app.js | 48 +
src/pages/setting.js | 66 +
src/pages/video.app.js | 51 +
src/pages/video.js | 66 +
src/reducers/explorer.js | 67 +
src/reducers/index.js | 350 +
src/reducers/navigator.js | 12 +
src/reducers/view.js | 38 +
src/serviceWorker.js | 131 +
src/untils/index.js | 69 +
110 files changed, 30943 insertions(+)
create mode 100644 .gitignore
create mode 100644 .travis.yml
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 config/env.js
create mode 100644 config/jest/cssTransform.js
create mode 100644 config/jest/fileTransform.js
create mode 100644 config/paths.js
create mode 100644 config/webpack.config.dev.js
create mode 100644 config/webpack.config.prod.js
create mode 100644 config/webpackDevServer.config.js
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 public/explore/result.html
create mode 100644 public/favicon.ico
create mode 100644 public/fileShare.html
create mode 100644 public/folderShare.html
create mode 100644 public/home/download.html
create mode 100644 public/home/home.html
create mode 100644 public/index.html
create mode 100644 public/lock.html
create mode 100644 public/manifest.json
create mode 100644 public/markdown.html
create mode 100644 public/member/login.html
create mode 100644 public/member/setting.html
create mode 100644 public/myShare.html
create mode 100644 public/profile.html
create mode 100644 public/profile/profile.html
create mode 100644 public/setting.html
create mode 100644 public/share/share_dir.html
create mode 100644 public/share/share_home.html
create mode 100644 public/share/share_lock.html
create mode 100644 public/share/share_single.html
create mode 100644 public/video.html
create mode 100644 public/viewer/markdown.html
create mode 100644 public/viewer/video.html
create mode 100644 scripts/build.js
create mode 100644 scripts/start.js
create mode 100644 scripts/test.js
create mode 100644 src/App.js
create mode 100644 src/App.test.js
create mode 100644 src/actions/index.js
create mode 100644 src/component/Download.js
create mode 100644 src/component/FileManager/ContextMenu.js
create mode 100644 src/component/FileManager/Explorer.js
create mode 100644 src/component/FileManager/FileIcon.js
create mode 100644 src/component/FileManager/FileManager.js
create mode 100644 src/component/FileManager/Folder.js
create mode 100644 src/component/FileManager/ImgPreview.js
create mode 100644 src/component/FileManager/Modals.js
create mode 100644 src/component/FileManager/Navigator.js
create mode 100644 src/component/FileManager/ObjectIcon.js
create mode 100644 src/component/FileManager/PathSelector.js
create mode 100644 src/component/FileManager/SmallIcon.js
create mode 100644 src/component/FileManager/TableRow.js
create mode 100644 src/component/LockedFile.js
create mode 100644 src/component/Login/EmailActivication.js
create mode 100644 src/component/Login/LoginForm.js
create mode 100644 src/component/Login/RegisterForm.js
create mode 100644 src/component/Login/ResetPwd.js
create mode 100644 src/component/Login/ResetPwdForm.js
create mode 100644 src/component/Login/TwoStep.js
create mode 100644 src/component/MyShare.js
create mode 100644 src/component/Navbar.js
create mode 100644 src/component/Profile.js
create mode 100644 src/component/Search.js
create mode 100644 src/component/SearchBar.js
create mode 100644 src/component/SharedFile.js
create mode 100644 src/component/SideDrawer.js
create mode 100644 src/component/Snackbar.js
create mode 100644 src/component/StorageBar.js
create mode 100644 src/component/Upload/FileList.js
create mode 100644 src/component/Uploader.js
create mode 100644 src/component/UserAvatar.js
create mode 100644 src/component/UserInfo.js
create mode 100644 src/component/UserSetting.js
create mode 100644 src/component/Viewer/markdown.js
create mode 100644 src/component/Viewer/video.js
create mode 100644 src/config.js
create mode 100644 src/index.js
create mode 100644 src/loader/index.js
create mode 100644 src/loader/utils.js
create mode 100644 src/pages/download.app.js
create mode 100644 src/pages/download.js
create mode 100644 src/pages/fileShare.app.js
create mode 100644 src/pages/fileShare.js
create mode 100644 src/pages/folderShare.app.js
create mode 100644 src/pages/folderShare.js
create mode 100644 src/pages/lock.app.js
create mode 100644 src/pages/lock.js
create mode 100644 src/pages/login.app.js
create mode 100644 src/pages/login.js
create mode 100644 src/pages/markdown.app.js
create mode 100644 src/pages/markdown.js
create mode 100644 src/pages/myShare.app.js
create mode 100644 src/pages/myShare.js
create mode 100644 src/pages/profile.app.js
create mode 100644 src/pages/profile.js
create mode 100644 src/pages/search.app.js
create mode 100644 src/pages/search.js
create mode 100644 src/pages/setting.app.js
create mode 100644 src/pages/setting.js
create mode 100644 src/pages/video.app.js
create mode 100644 src/pages/video.js
create mode 100644 src/reducers/explorer.js
create mode 100644 src/reducers/index.js
create mode 100644 src/reducers/navigator.js
create mode 100644 src/reducers/view.js
create mode 100644 src/serviceWorker.js
create mode 100644 src/untils/index.js
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f491785
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..3c10708
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+language: node_js
+node_js:
+ - '10.13.0'
+before_script: npm install
+script: npm run-script build
+after_success:
+ - zip -r -q -o pack.zip ./build
+ - curl -F "token=$TOKEN" -F "commit=$TRAVIS_COMMIT" -F "source=frontend" -F "filename=@pack.zip" -H "Expect:" http://cloudreve.org/deploy.php
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..80102fa
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 AaronLiu
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d6171b8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+cloudreve-frontend [](https://travis-ci.org/HFO4/cloudreve-frontend)
+=========================
+
+Build:
+
+```
+npm install
+npm run-script build
+```
+
diff --git a/config/env.js b/config/env.js
new file mode 100644
index 0000000..b0344c5
--- /dev/null
+++ b/config/env.js
@@ -0,0 +1,93 @@
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+const paths = require('./paths');
+
+// Make sure that including paths.js after env.js will read .env variables.
+delete require.cache[require.resolve('./paths')];
+
+const NODE_ENV = process.env.NODE_ENV;
+if (!NODE_ENV) {
+ throw new Error(
+ 'The NODE_ENV environment variable is required but was not specified.'
+ );
+}
+
+// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
+var dotenvFiles = [
+ `${paths.dotenv}.${NODE_ENV}.local`,
+ `${paths.dotenv}.${NODE_ENV}`,
+ // Don't include `.env.local` for `test` environment
+ // since normally you expect tests to produce the same
+ // results for everyone
+ NODE_ENV !== 'test' && `${paths.dotenv}.local`,
+ paths.dotenv,
+].filter(Boolean);
+
+// Load environment variables from .env* files. Suppress warnings using silent
+// if this file is missing. dotenv will never modify any environment variables
+// that have already been set. Variable expansion is supported in .env files.
+// https://github.com/motdotla/dotenv
+// https://github.com/motdotla/dotenv-expand
+dotenvFiles.forEach(dotenvFile => {
+ if (fs.existsSync(dotenvFile)) {
+ require('dotenv-expand')(
+ require('dotenv').config({
+ path: dotenvFile,
+ })
+ );
+ }
+});
+
+// We support resolving modules according to `NODE_PATH`.
+// This lets you use absolute paths in imports inside large monorepos:
+// https://github.com/facebook/create-react-app/issues/253.
+// It works similar to `NODE_PATH` in Node itself:
+// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
+// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
+// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
+// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
+// We also resolve them to make sure all tools using them work consistently.
+const appDirectory = fs.realpathSync(process.cwd());
+process.env.NODE_PATH = (process.env.NODE_PATH || '')
+ .split(path.delimiter)
+ .filter(folder => folder && !path.isAbsolute(folder))
+ .map(folder => path.resolve(appDirectory, folder))
+ .join(path.delimiter);
+
+// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
+// injected into the application via DefinePlugin in Webpack configuration.
+const REACT_APP = /^REACT_APP_/i;
+
+function getClientEnvironment(publicUrl) {
+ const raw = Object.keys(process.env)
+ .filter(key => REACT_APP.test(key))
+ .reduce(
+ (env, key) => {
+ env[key] = process.env[key];
+ return env;
+ },
+ {
+ // Useful for determining whether we’re running in production mode.
+ // Most importantly, it switches React into the correct mode.
+ NODE_ENV: process.env.NODE_ENV || 'development',
+ // Useful for resolving the correct path to static assets in `public`.
+ // For example, .
+ // This should only be used as an escape hatch. Normally you would put
+ // images into the `src` and `import` them in code to get their paths.
+ PUBLIC_URL: publicUrl,
+ }
+ );
+ // Stringify all values so we can feed into Webpack DefinePlugin
+ const stringified = {
+ 'process.env': Object.keys(raw).reduce((env, key) => {
+ env[key] = JSON.stringify(raw[key]);
+ return env;
+ }, {}),
+ };
+
+ return { raw, stringified };
+}
+
+module.exports = getClientEnvironment;
diff --git a/config/jest/cssTransform.js b/config/jest/cssTransform.js
new file mode 100644
index 0000000..8f65114
--- /dev/null
+++ b/config/jest/cssTransform.js
@@ -0,0 +1,14 @@
+'use strict';
+
+// This is a custom Jest transformer turning style imports into empty objects.
+// http://facebook.github.io/jest/docs/en/webpack.html
+
+module.exports = {
+ process() {
+ return 'module.exports = {};';
+ },
+ getCacheKey() {
+ // The output is always the same.
+ return 'cssTransform';
+ },
+};
diff --git a/config/jest/fileTransform.js b/config/jest/fileTransform.js
new file mode 100644
index 0000000..07010e3
--- /dev/null
+++ b/config/jest/fileTransform.js
@@ -0,0 +1,30 @@
+'use strict';
+
+const path = require('path');
+
+// This is a custom Jest transformer turning file imports into filenames.
+// http://facebook.github.io/jest/docs/en/webpack.html
+
+module.exports = {
+ process(src, filename) {
+ const assetFilename = JSON.stringify(path.basename(filename));
+
+ if (filename.match(/\.svg$/)) {
+ return `module.exports = {
+ __esModule: true,
+ default: ${assetFilename},
+ ReactComponent: (props) => ({
+ $$typeof: Symbol.for('react.element'),
+ type: 'svg',
+ ref: null,
+ key: null,
+ props: Object.assign({}, props, {
+ children: ${assetFilename}
+ })
+ }),
+ };`;
+ }
+
+ return `module.exports = ${assetFilename};`;
+ },
+};
diff --git a/config/paths.js b/config/paths.js
new file mode 100644
index 0000000..bb13e80
--- /dev/null
+++ b/config/paths.js
@@ -0,0 +1,57 @@
+'use strict';
+
+const path = require('path');
+const fs = require('fs');
+const url = require('url');
+
+// Make sure any symlinks in the project folder are resolved:
+// https://github.com/facebook/create-react-app/issues/637
+const appDirectory = fs.realpathSync(process.cwd());
+const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
+
+const envPublicUrl = process.env.PUBLIC_URL;
+
+function ensureSlash(inputPath, needsSlash) {
+ const hasSlash = inputPath.endsWith('/');
+ if (hasSlash && !needsSlash) {
+ return inputPath.substr(0, inputPath.length - 1);
+ } else if (!hasSlash && needsSlash) {
+ return `${inputPath}/`;
+ } else {
+ return inputPath;
+ }
+}
+
+const getPublicUrl = appPackageJson =>
+ envPublicUrl || require(appPackageJson).homepage;
+
+// We use `PUBLIC_URL` environment variable or "homepage" field to infer
+// "public path" at which the app is served.
+// Webpack needs to know it to put the right
+
+
+