@samitouri / QOSami-HFS / commits / f1e40209

removed legacy code

Massimo Melina committed Nov 1, 2023 at 17:29 UTC f1e40209c02e65bc462ad1786989bcfac5518a0f
6 files changed +5 -18
admin/src/addFiles.ts
-1
@@ -7,7 +7,6 @@ import { reloadVfs } from './VfsPage'
7 import { state } from './state'
8 import { apiCall } from './api'
9 import FilePicker from './FilePicker'
10 -import { onlyTruthy } from './misc'
10
11 export default function addFiles() {
12 const { close } = newDialog({
plugins/antibrute/plugin.js
+1 -1
@@ -13,7 +13,7 @@ exports.configDialog = {
13 const byIp = {}
14
15 exports.init = api => {
16 - const LOGIN_URI = api.const.API_URI + 'loginSrp1'
16 + const LOGIN_URI = api.Const.API_URI + 'loginSrp1'
17 const { getOrSet } = api.require('./misc')
18 return {
19 async middleware(ctx) {
plugins/vhosting/plugin.js
+3 -3
@@ -26,11 +26,11 @@ exports.init = api => {
26 return {
27 middleware(ctx) {
28 let params // undefined if we are not going to work on api parameters
29 - if (ctx.path.startsWith(api.const.SPECIAL_URI)) { // special uris should be excluded...
30 - if (!ctx.path.startsWith(api.const.API_URI)) return // ...unless it's an api
29 + if (ctx.path.startsWith(api.Const.SPECIAL_URI)) { // special uris should be excluded...
30 + if (!ctx.path.startsWith(api.Const.API_URI)) return // ...unless it's an api
31 let { referer } = ctx.headers
32 referer &&= new URL(referer).pathname
33 - if (referer?.startsWith(ctx.state.revProxyPath + api.const.ADMIN_URI)) return // exclude apis for admin-panel
33 + if (referer?.startsWith(ctx.state.revProxyPath + api.Const.ADMIN_URI)) return // exclude apis for admin-panel
34 params = ctx.params || ctx.query // for api we'll translate params
35 }
36
src/api.vfs.ts
-4
@@ -255,10 +255,6 @@ function simplifyName(node: VfsNode) {
255
256 const WINDOWS_REG_KEY = 'HKCU\\Software\\Classes\\*\\shell\\AddToHFS3'
257
258 -if (IS_WINDOWS) // legacy 0.49.0-beta7 2023-10-27. Remove in 0.50
259 - for (const k of ['*', 'Directory'])
260 - reg('delete', `HKCR\\${k}\\shell\\AddToHFS3`, '/f').catch(() => {})
261 -
258 export async function windowsIntegration() {
259 const status = await getServerStatus()
260 const url = 'http://localhost:' + status.http.port
src/plugins.ts
+1 -2
@@ -3,7 +3,7 @@
3 import glob from 'fast-glob'
4 import { watchLoad } from './watchLoad'
5 import _ from 'lodash'
6 -import { API_VERSION, APP_PATH, COMPATIBLE_API_VERSION, IS_WINDOWS, PLUGINS_PUB_URI, HTTP_FAILED_DEPENDENCY } from './const'
6 +import { API_VERSION, APP_PATH, COMPATIBLE_API_VERSION, IS_WINDOWS, PLUGINS_PUB_URI } from './const'
7 import * as Const from './const'
8 import Koa from 'koa'
9 import {
@@ -98,7 +98,6 @@ export function getPluginConfigFields(id: string) {
98
99 async function initPlugin<T>(pl: any, more?: T) {
100 return Object.assign(pl, await pl.init?.({
101 - const: Const, // legacy, deprecated in 0.48
101 Const,
102 require,
103 getConnections,
src/vfs.ts
-7
@@ -24,7 +24,6 @@ export interface VfsNodeStored extends VfsPerms {
24 rename?: Record<string, string>
25 masks?: Masks // express fields for descendants that are not in the tree
26 accept?: string
27 - propagate?: Record<keyof VfsPerms, boolean> // legacy pre-0.47
27 }
28 export interface VfsNode extends VfsNodeStored { // include fields that are only filled at run-time
29 isTemp?: true // this node doesn't belong to the tree and was created by necessity
@@ -138,12 +137,6 @@ export async function urlToNode(url: string, ctx?: Koa.Context, parent: VfsNode=
137 export let vfs: VfsNode = {}
138 defineConfig<VfsNode>('vfs', {}).sub(data =>
139 vfs = (function recur(node) {
141 - if (node.propagate) { // legacy pre-0.47
142 - for (const [k,v] of typedEntries(node.propagate))
143 - if (v === false)
144 - node[k] = { this: node[k] }
145 - delete node.propagate
146 - }
140 if (node.children)
141 for (const c of node.children)
142 recur(c)