const component_share = {
emits: ['play_audio', 'set_token'],
props: ['token'],
template: `
Share with others!
{{ error_status }}
Share link: {{ computed_share_link }} , or share this page directly.
| Filename |
Folder Name |
Size |
`,
computed: {
computed_share_link() {
return window.location.href
},
},
data() {
return {
file: {},
error_status: "",
}
},
mounted() {
if (this.$route.query.id) {
this.get_file_info()
}
},
methods: {
get_file_info() {
axios.post('/api/v1/get_file_info', {
id: parseInt(this.$route.query.id),
}).then((response) => {
this.file = response.data
}).catch((error) => {
if (error.response) {
this.error_status = error.response.data.status
} else {
this.error_status = 'Network error'
}
})
},
},
}
const component_search_folders = {
emits: ['play_audio', 'set_token'],
props: ['token'],
data() {
return {
search_foldernames: "",
folders: [],
folder: {},
offset: 0,
limit: 10,
folder_offset: 0,
folder_limit: 10,
files_in_folder: [],
playing_audio_file: {},
is_loading: false,
error_status: "",
}
},
computed: {
computed_folders_page() {
if (this.is_loading) {
return 'Loading...'
}
if (this.error_status) {
return this.error_status
}
return this.offset + ' ~ ' + (this.offset + this.folders.length)
},
computed_files_page() {
if (this.is_loading) {
return 'Loading...'
}
if (this.error_status) {
return this.error_status
}
return this.folder_offset + ' ~ ' + (this.folder_offset + this.files_in_folder.length)
},
},
template: `
`,
mounted() {
if (this.$route.query.folder_id) {
this.folder.id = parseInt(this.$route.query.folder_id)
this.get_files_in_folder()
}
},
methods: {
folder_last_page() {
this.folder_offset = this.folder_offset - this.folder_limit
if (this.folder_offset < 0) {
this.folder_offset = 0
return
}
this.get_files_in_folder()
},
folder_next_page() {
this.folder_offset = this.folder_offset + this.folder_limit
this.get_files_in_folder()
},
view_folder(folder) {
this.folder = folder
this.get_files_in_folder()
},
get_files_in_folder() {
this.is_loading = true
axios.post('/api/v1/get_files_in_folder', {
folder_id: this.folder.id,
limit: this.folder_limit,
offset: this.folder_offset,
}).then((response) => {
this.error_status = ""
this.files_in_folder = response.data.files
}).catch((error) => {
if (error.response) {
this.error_status = error.response.data.status
} else {
this.error_status = 'Network error'
}
}).finally(() => {
this.is_loading = false
})
},
last_page() {
this.offset = this.offset - this.limit
if (this.offset < 0) {
this.offset = 0
return
}
this.search_folders()
},
next_page() {
this.offset = this.offset + this.limit
this.search_folders()
},
first_search_folders() {
this.offset = 0
this.search_folders()
},
search_folders() {
this.is_loading = true
axios.post('/api/v1/search_folders', {
foldername: this.search_foldernames,
limit: this.limit,
offset: this.offset,
}).then((response) => {
this.error_status = ""
this.folders = response.data.folders
}).catch((error) => {
if (error.response) {
this.error_status = error.response.data.status
} else {
this.error_status = 'Network error'
}
}).finally(() => {
this.is_loading = false
})
},
},
}
const component_token = {
progs: ['token'],
emits: ['set_token'],
data() {
return {
token_tmp: "",
}
},
template: `
关于本站
一只随处可见的 葱厨&车万人 想听 TA 屯在硬盘里的音乐。
一点点说明:下方播放器的 Raw 模式即不转码直接播放源文件,支持断点续传;Prepare 模式:勾选后播放的文件将提前在服务器端转码,然后以支持断点续传的方式提供,如果你的网络不稳定,经常播放到一半就中断,可以尝试勾选 Prepare。
站内音乐来自公开网络,仅供个人使用,如有侵权或建议请提交反馈
`,
methods: {
submit_feedback() {
axios.post('/api/v1/feedback', {
feedback: this.feedback,
}).then((response) => {
this.submit_disabled = true
this.feedback = ""
this.feedback_status = "Success"
this.feedback_placeholder = "Thanks for your feedback!"
this.is_err = false
}).catch((err) => {
console.log(err)
this.is_err = true
this.err_msg = err.response.data.status
})
},
}
}
const component_manage_database = {
props: ['token'],
data() {
return {
root: "",
pattern: [".flac", ".mp3"],
pattern_tmp: "",
s: "",
}
},
template: `
`,
data() {
return {
search_filenames: '',
files: [],
offset: 0,
limit: 10,
playing_audio_file: {},
is_loading: false,
error_status: "",
}
},
methods: {
first_search_files() {
this.offset = 0
this.search_files()
},
search_files() {
this.is_loading = true
axios.post('/api/v1/search_files', {
filename: this.search_filenames,
limit: this.limit,
offset: this.offset,
}).then((response) => {
this.error_status = ""
this.files = response.data.files
}).catch((error) => {
if (error.response) {
this.error_status = error.response.data.status
} else {
this.error_status = 'Network error'
}
}).finally(() => {
this.is_loading = false
})
},
last_page() {
this.offset = this.offset - this.limit
if (this.offset < 0) {
this.offset = 0
return
}
this.search_files()
},
next_page() {
this.offset = this.offset + this.limit
this.search_files()
},
},
}
const component_get_random_files = {
emits: ['play_audio', 'set_token'],
props: ['token'],
data() {
return {
files: [],
is_loading: false,
error_status: "",
}
},
computed: {
computed_refresh() {
if (this.error_status) {
return this.error_status
}
if (this.is_loading) {
return 'Loading...'
}
return 'Refresh'
},
},
template: `