2019-07-01 23:01:09 +00:00
|
|
|
// 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.
|
2019-07-22 21:00:59 +00:00
|
|
|
module.exports = (remoteAuthority) => {
|
2019-07-01 23:01:09 +00:00
|
|
|
return {
|
|
|
|
transformIncoming: (uri) => {
|
|
|
|
switch (uri.scheme) {
|
2019-07-22 21:00:59 +00:00
|
|
|
case "code-server": return { scheme: "file", path: uri.path };
|
|
|
|
case "file": return { scheme: "code-server-local", path: uri.path };
|
2019-07-01 23:01:09 +00:00
|
|
|
default: return uri;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
transformOutgoing: (uri) => {
|
|
|
|
switch (uri.scheme) {
|
2019-07-22 21:00:59 +00:00
|
|
|
case "code-server-local": return { scheme: "file", path: uri.path };
|
|
|
|
case "file": return { scheme: "code-server", authority: remoteAuthority, path: uri.path };
|
2019-07-01 23:01:09 +00:00
|
|
|
default: return uri;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
transformOutgoingScheme: (scheme) => {
|
|
|
|
switch (scheme) {
|
2019-07-22 21:00:59 +00:00
|
|
|
case "code-server-local": return "file";
|
|
|
|
case "file": return "code-server";
|
2019-07-01 23:01:09 +00:00
|
|
|
default: return scheme;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|