forked from coder/code-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuriTransformer.js
More file actions
27 lines (27 loc) · 867 Bytes
/
uriTransformer.js
File metadata and controls
27 lines (27 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// This file is included via a regular Node require. I'm not sure how (or if)
// we can write this in Typescript and have it compile to non-AMD syntax.
module.exports = (remoteAuthority) => {
return {
transformIncoming: (uri) => {
switch (uri.scheme) {
case "code-server": return { scheme: "file", path: uri.path };
case "file": return { scheme: "code-server", path: uri.path };
default: return uri;
}
},
transformOutgoing: (uri) => {
switch (uri.scheme) {
case "code-server": return { scheme: "file", path: uri.path };
case "file": return { scheme: "code-server", authority: remoteAuthority, path: uri.path };
default: return uri;
}
},
transformOutgoingScheme: (scheme) => {
switch (scheme) {
case "code-server": return "file";
case "file": return "code-server";
default: return scheme;
}
},
};
};