Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Initial commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Aicirou committed Mar 19, 2022
0 parents commit 9b14d06
Show file tree
Hide file tree
Showing 138 changed files with 28,097 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_CDN_PATH=https://cdn.jsdelivr.net/gh/Aicirou/goindex-theme-acrou@master/dist/
#VUE_APP_CDN_PATH=https://cloud.jsonpop.cn/go2index/vue/dist/
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# development environment
VUE_APP_API=/api
VUE_APP_CDN_PATH=/
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
src/test

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Aicirou

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.
131 changes: 131 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@


# GoIndex-theme-acrou
Combining the power of [Cloudflare Workers](https://workers.cloudflare.com/) and [Google Drive](https://www.google.com/drive/) will allow you to index you files on the browser on Cloudflare Workers.

[go2index/index.js](https://github.com/Aicirou/goindex-theme-acrou/blob/main/go2index/index.js) is the content of the Workers script.

This theme's goindex is currently based on [yanzai/goindex](https://github.com/yanzai/goindex/).
## Demo

Go to: [https://chill.iitkgp.workers.dev/](https://chill.iitkgp.workers.dev/)

## Features

- [x] 👑 Page-level caching,browser forward and backward without reloading (MAC users have a better experience with the trackpad)
- [x] 🗂 Multi drive switching
- [x] 🔐 Http Basic Auth
- [x] 🎨 Grid view mode(File Preview)
- [x] 🎯 Paging load
- [x] 🌐 I18n(multi-language)
- [x] 🛠 Markdown/Html render (Maybe it can be your blog)
- [x] 🖥 Video Online(.vtt subtitle)
- [x] 🕹 Support for custom video player (API)
- [x] 🎧 Audio Online
- [x] 🚀 Faster speed

## TODO

- [ ] More file format preview
- [ ] Let goindex be more than just a directory index

## Quick Deployment

1. Open the following link

- https://goindex-builder-acrou.glitch.me

2. Auth and get the code
3. Deploy the code to [Cloudflare Workers](https://www.cloudflare.com/)

## Deployment

1. Open [Google Drive API](https://console.developers.google.com/apis/api/drive.googleapis.com/overview)
2. Create a [OAuth client ID](https://console.developers.google.com/apis/credentials/oauthclient)
3. Install [rclone](https://rclone.org/downloads/) software locally
4. Get `refresh_token ` with `rclone`
5. Download `index.js` in https://github.com/Aicirou/goindex-theme-acrou/tree/master/go2index and replace `client_id`,`client_secret`,`refresh_token` for what you just got.
6. Deploy the code to [Cloudflare Workers](https://www.cloudflare.com/)

## Options

### Video

| Option | Type | Default | Description |
| ------------ | -------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `api` | String | `''` | External video player api. When this value is not null, all of the following options do not work |
| `autoplay` | Boolean | `true` | When set to true, the video plays automatically, depending on whether the browser supports the |
| `invertTime` | Boolean | `false` | Display the current time as a countdown rather than an incremental counter. |
| `controls` | Array, Function or Element | `['play-large', 'restart', 'play', 'progress', 'current-time', 'duration', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'download', 'fullscreen']` | Which buttons are displayed in the control bar. See more [CONTROLS.md](https://github.com/sampotts/plyr/blob/master/CONTROLS.md#using-default-controls) |
| `settings` | Array | `['quality', 'speed', 'loop']` | You can specify which settings to show in the menu |

For more option, see plyr [options](https://github.com/sampotts/plyr#options)

### Audio

| Option | Type | Default | Description |
| ----------- | ------- | ---------- | ------------------------------------------------------------ |
| `container` | String | `.aplayer` | No support for changes |
| `fixed` | Boolean | `true` | No support for changes |
| `autoplay` | Boolean | `false` | audio autoplay |
| `loop` | String | `'all'` | player loop play, values: 'all', 'one', 'none' |
| `order` | String | `'list'` | player play order, values: 'list', 'random' |
| `preload` | String | `'auto'` | values: 'none', 'metadata', 'auto' |
| `volume` | Number | `0.7` | default volume, notice that player will remember user setting, default volume will not work after user set volume themselves |
| `audios` | Array | `[]` | Playlists can be preset. [FAQ](#FAQ) |

For more option, see APlayer [options](https://aplayer.js.org/#/home?id=options)

## Change log

### v2.0.8

- Fix image file actions does not work
- Fix misjudged file to image format
- Fix more than 10 drive not working
- Fix some of the operation functions in the search list cannot be used
- Fix text cache content not refreshing
- Add video default player([plyr](https://github.com/sampotts/plyr))
- Add audio player ([APlayer](https://github.com/MoePlayer/APlayer))
- Add copy button to video page
- Add [NProgress](https://github.com/rstacruz/nprogress)
- Add language cache cleanup
- Add shortcut can't download tip
- Markdown displays rendered html by default
- CLI Delete prefetch preload of lazy load module
- Delete fontawesome5

### Fixed issues

- Add clean file cache
- Support for custom video player (API)
- Beautify: the grid mode file shows icon when no preview is shown
- Beautify: Adjust the HEAD.md render position
- Solve the problem that files that can't be previewed can't be downloaded directly by clicking
- Solve the problem that the file name cannot be opened
- Solve the problem that switching pages will fall back in the current page loading

- Program changed to SPA(single page application)
- Add page level cache(Browser forward and backward do not refresh seconds to load, and Mac users have a better experience of using touch pad)
- Add http basic auth(Each drive letter can be configured with a user name and password separately, which can protect all sub files and sub folders under the drive)
- Add grid view mode(File preview)
- Add paging load
- Add i18n
- Add html render
- Add render folder/file description
- Add optional configuration
- Support quick deployment
- Support PDF Online preview
- Replace text editor
- Solve the problem of URL encoding
- Solve other known problems

- Support multi disk switching
- Add version detection
- Optimize search results
- Optimize page display

## Lisense

[MIT](LICENSE)

3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
};
86 changes: 86 additions & 0 deletions buildAppJSPlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
const cdnDependencies = require("./dependencies-cdn");

// cdn link to import file
const cdn = {
css: cdnDependencies.map((e) => e.css).filter((e) => e),
js: cdnDependencies.map((e) => e.js).filter((e) => e),
};

class BuildAppJSPlugin {
apply(compiler) {
compiler.hooks.emit.tapAsync(
"BuildAppJSPlugin",
(compilation, callback) => {
const isProd = process.env.NODE_ENV === "production";
let cssarr = [];
let jsarr = [];
let reg = "";
if (isProd) {
reg = "(app|chunk-vendors)\\.";
}
// Iterate over all compiled resource files
for (let filename in compilation.assets) {
if (filename.match(reg + ".*\\.js$")) {
if (isProd) {
filename = (process.env.VUE_APP_CDN_PATH || "/") + filename;
} else {
filename = "/" + filename;
}
jsarr.push(filename);
}
if (filename.match(reg + ".*\\.css$")) {
cssarr.push(filename);
}
}
cssarr = cssarr.sort(function (a) {
return a.indexOf("app.");
});
var cdnjs = "";
if (isProd) {
cssarr = cdn.css.concat(cssarr);
cdnjs = `var cdnjs = ${JSON.stringify(cdn.js)};
cdnjs.forEach((item) => {
document.write('<script src="' + item + '"></script>');
});`;
} else {
cssarr = cssarr.concat(
cdnDependencies.filter((e) => e.name === "").map((e) => e.css)
);
}
let content = `
var scripts = ${JSON.stringify(jsarr)};
${cdnjs}
scripts.forEach((item) => {
document.write('<script src="' + item + '"></script>');
});
`;
let cssContent = "";
cssarr.forEach((item) => {
cssContent += `@import url(${item});\n`;
});
// Insert this list as a new file asset into the webpack build:
compilation.assets["app.js"] = {
source: function () {
return content;
},
size: function () {
return jsarr.length;
},
};

compilation.assets["style.css"] = {
source: function () {
return cssContent;
},
size: function () {
return cssarr.length;
},
};

callback();
}
);
}
}

module.exports = BuildAppJSPlugin;
79 changes: 79 additions & 0 deletions dependencies-cdn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
module.exports = [
{
name: "vue",
library: "Vue",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js",
css: "",
},
{
name: "vue-i18n",
library: "VueI18n",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-i18n.min.js",
css: "",
},
{
name: "vue-router",
library: "VueRouter",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-router.min.js",
css: "",
},
{
name: "vuex",
library: "Vuex",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex.js",
css: "",
},
{
name: "axios",
library: "axios",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js",
css: "",
},
{
name: "element-ui",
library: "ELEMENT",
js: "https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js" /* , css: 'https://cdn.jsdelivr.net/npm/[email protected]/lib/theme-chalk/index.css' */,
},
{
name: "lodash",
library: "_",
js: "https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js",
css: "",
},
{
name: "js-cookie",
library: "Cookies",
js: "https://cdn.jsdelivr.net/npm/[email protected]/src/js.cookie.min.js",
css: "",
},
{
name: "lowdb",
library: "low",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/low.min.js",
css: "",
},
{
name: "lowdb/adapters/LocalStorage",
library: "LocalStorage",
js: "https://cdn.jsdelivr.net/npm/[email protected]/dist/LocalStorage.min.js",
css: "",
},
{
name: "",
library: "",
js: "https://at.alicdn.com/t/font_1760192_8add3xcxs4u.js",
css: "",
},
{
name: "",
library: "",
js: "",
css: "https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css",
},
{
name: "",
library: "",
js: "",
css: "https://cdn.jsdelivr.net/npm/[email protected]/dist/font-awesome-animation.min.css",
},
];
23 changes: 23 additions & 0 deletions dist/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var scripts = [
"https://cdn.jsdelivr.net/gh/Aicirou/[email protected]/dist/js/app.da7f5f3f.js",
"https://cdn.jsdelivr.net/gh/Aicirou/[email protected]/dist/js/chunk-vendors.3c185c97.js",
];
var cdnjs = [
"https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-i18n.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-router.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex.js",
"https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js",
"https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/src/js.cookie.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/dist/low.min.js",
"https://cdn.jsdelivr.net/npm/[email protected]/dist/LocalStorage.min.js",
"https://at.alicdn.com/t/font_1760192_8add3xcxs4u.js",
];
cdnjs.forEach((item) => {
document.write('<script src="' + item + '"></script>');
});
scripts.forEach((item) => {
document.write('<script src="' + item + '"></script>');
});
1 change: 1 addition & 0 deletions dist/css/app.a0b47f7b.css

Large diffs are not rendered by default.

Binary file added dist/css/app.a0b47f7b.css.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/css/chunk-02979915.7494f567.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/css/chunk-075e2f32.63d5b552.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9b14d06

Please sign in to comment.