Skip to content

Commit

Permalink
Web Support & Better Support Message (#205)
Browse files Browse the repository at this point in the history
* Added clarifying information for checksum install issues

* Added web extension

* Including app directory in checksum fix

* Lint n stuff

* Updated changelog & bump version to v88.4-1.6.0
  • Loading branch information
Unthrottled authored Feb 26, 2023
1 parent 6e64da6 commit 7c6924b
Show file tree
Hide file tree
Showing 7 changed files with 984 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 88.4-1.6.0 [VS Code Web Support]

- Extension now supported in [VSCode for the web](https://code.visualstudio.com/docs/editor/vscode-web).
- Added better checksum restoration error message.
- Updated Sagiri's syntax highlighting color a bit.

## 88.3-1.5.2 [Hide Watermark Restore]

- Restored hide watermark functionality for VSCode 1.75.0. Please re-run the hide watermark command for this to take effect.
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Doki Theme",
"description": "Cute anime character themes!",
"publisher": "unthrottled",
"version": "88.1.13",
"version": "88.1.14",
"license": "MIT",
"icon": "Doki-Theme-v2.png",
"galleryBanner": {
Expand Down Expand Up @@ -242,6 +242,7 @@
"onCommand:doki-theme.theme.wallpaper.Shima Rin"
],
"main": "./out/extension.js",
"browser": "./out/web-extension.bundled.js",
"contributes": {
"configuration": [
{
Expand Down Expand Up @@ -1670,9 +1671,10 @@
},
"scripts": {
"package": "vsce package",
"vscode:prepublish": "yarn run compile",
"package-web": "webpack --mode production --devtool hidden-source-map",
"vscode:prepublish": "yarn run compile && yarn package-web",
"vscode:uninstall": "node ./out/Cleanup.js",
"compile": "tsc -p ./",
"compile": "tsc -p ./ && yarn package-web",
"watch": "tsc -watch -p ./",
"pretest": "yarn run compile",
"test": "node ./out/test/runTest.js"
Expand All @@ -1689,10 +1691,13 @@
"lodash": "^4.17.21",
"markdown-it": "^12.3.2",
"mocha": "^6.2.2",
"ts-loader": "^9.4.2",
"ts-node": "^8.6.2",
"tslint": "^5.20.0",
"typescript": "^3.6.4",
"vscode-test": "^1.2.2"
"vscode-test": "^1.2.2",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"resolutions": {
"minimist": "0.2.1"
Expand Down
2 changes: 1 addition & 1 deletion src/NotificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { VSCodeGlobals } from "./VSCodeGlobals";
import { attemptToGreetUser } from "./WelcomeService";

const SAVED_VERSION = "doki.theme.version";
const DOKI_THEME_VERSION = "v88.3-1.5.2";
const DOKI_THEME_VERSION = "v88.4-1.6.0";

export function attemptToNotifyUpdates(context: vscode.ExtensionContext) {
const savedVersion = VSCodeGlobals.globalState.get(SAVED_VERSION);
Expand Down
9 changes: 5 additions & 4 deletions src/SupportService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';
import { getWebviewIcon, buildWebviewHtml } from "./ChangelogService";
import { productFile } from './CheckSumService';
import { workbenchDirectory } from './ENV';
import { appDirectory, workbenchDirectory } from './ENV';

export function showStickerInstallationSupportWindow(context: vscode.ExtensionContext) {
const verbs = {
Expand Down Expand Up @@ -40,14 +40,15 @@ export function showChecksumFixHelp(
error. No worries, friend, I am here to help.
</p>
<p>
I need access to <strong>${productFile}</strong> and to also be able to add files in that directory.
So I can fix VS Code's checksums (which removes the [Unsupported] message).
I need access to <strong>${productFile}</strong> and to also be able to add files in <strong>${appDirectory}</strong>.
So I can fix VS Code's checksums (which removes the [Unsupported] message) and make a copy of the original file to restore.
Please take a moment to make sure the file actually exists and I can add files to that directory.
</p>
<h2>Linux/MacOS</h2>
<p>If you are running Linux or MacOS you can help me by running this command:</p>
<code>sudo chown $(whoami) ${productFile}</code>
<p>After you have given yourself permission to write that file, feel free to run your previous command again.</p>
<code>sudo chown $(whoami) ${appDirectory}</code>
<p>After you have given yourself permission to write that file and <em>create files in that directory</em>, feel free to run your previous command again.</p>
<p>If you have VS Code installed via <code>snap</code> please <a href="https://github.com/doki-theme/doki-theme-vscode/issues/34#issuecomment-730028177">see this workaround</a></p>
<p>On MacOS, if you have VS Code in your <code>Downloads</code> folder please <a href="https://github.com/doki-theme/doki-theme-vscode/issues/137">see this workaround</a></p>
Expand Down
58 changes: 58 additions & 0 deletions src/web-extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as vscode from "vscode";
import DokiThemeDefinitions from "./DokiThemeDefinitions";
import { VSCodeGlobals } from "./VSCodeGlobals";
import { VSCodeDokiThemeDefinition } from "./extension";


const showNonOp = () => vscode.window
.showInformationMessage(
`This feature does not work on the web version of VSCode 🥲`,
{ title: "That does not work." }
);

export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand("doki-theme.remove.sticker", () =>
showNonOp()
)
);

context.subscriptions.push(
vscode.commands.registerCommand("doki-theme.doki.changelog", () =>
showNonOp()
)
);

context.subscriptions.push(
vscode.commands.registerCommand("doki-theme.remove.watermark", () =>
showNonOp()
)
);

context.subscriptions.push(
vscode.commands.registerCommand("doki-theme.restore.assets", () =>
showNonOp()
)
);

VSCodeGlobals.globalState = context.globalState;

DokiThemeDefinitions.map((dokiThemeDefinition: VSCodeDokiThemeDefinition) =>
dokiThemeDefinition.extensionNames.map((extensionCommand) => ({
extensionCommand,
dokiThemeDefinition,
}))
)
.reduce((accum, next) => accum.concat(next), [])
.map(({ extensionCommand }) =>
vscode.commands.registerCommand(extensionCommand, () => {
showNonOp()
}
)
)
.forEach((disposableHero) => context.subscriptions.push(disposableHero));

}

export function deactivate() {
}
62 changes: 62 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//@ts-check
'use strict';

//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/

const path = require('path');
const webpack = require('webpack');

/** @type WebpackConfig */
const webExtensionConfig = {
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
target: 'webworker', // extensions run in a webworker context
entry: {
'web-extension': './src/web-extension.ts', // source of the web extension main file
},
output: {
filename: '[name].bundled.js',
path: path.join(__dirname, './out'),
libraryTarget: 'commonjs',
},
resolve: {
mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
extensions: ['.ts', '.js'], // support ts-files and js-files
alias: {
// provides alternate implementation for node module and source files
},
fallback: {
// Webpack 5 no longer polyfills Node.js core modules automatically.
// see https://webpack.js.org/configuration/resolve/#resolvefallback
// for the list of Node.js core module polyfills.
assert: require.resolve('assert'),
},
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/, /out/],
use: [
{
loader: 'ts-loader',
},
],
},
],
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser', // provide a shim for the global `process` variable
}),
],
externals: {
vscode: 'commonjs vscode', // ignored because it doesn't exist
},
performance: {
hints: false,
},
devtool: 'nosources-source-map', // create a source map that points to the original source file
};

module.exports = [webExtensionConfig];
Loading

0 comments on commit 7c6924b

Please sign in to comment.