Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #25

Merged
merged 34 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c8c7364
chore: prod only config
Keyrxng Nov 21, 2024
be54fb7
chore: fetch and render readme
Keyrxng Nov 21, 2024
a102b43
feat: new dropdown, installed indicator
Keyrxng Nov 21, 2024
20a403d
chore: load installed config values if present
Keyrxng Nov 21, 2024
f207e69
feat: reset to defaults
Keyrxng Nov 21, 2024
07bc746
chore: oauth redirect
Keyrxng Nov 21, 2024
afe5ab1
chore: remove search parsing
Keyrxng Nov 21, 2024
ff91dde
chore: eslint and cleanup
Keyrxng Nov 21, 2024
61a536b
chore: split renderer into files
Keyrxng Nov 21, 2024
2a2a83f
chore: minor fixes
Keyrxng Nov 21, 2024
359e095
chore: markdown-it readme rendering, minor fixes
Keyrxng Nov 21, 2024
d8b6470
chore: feedback and await early
Keyrxng Nov 21, 2024
746306a
Merge remote-tracking branch 'upstream/main' into improvements
Keyrxng Nov 21, 2024
67dad93
chore: responsive padding, resize after nav
Keyrxng Nov 22, 2024
eadc53b
chore: disable remove if not installed
Keyrxng Nov 22, 2024
87076db
chore: knip ignore
Keyrxng Nov 22, 2024
2921cb9
chore: loading title on fetch
Keyrxng Nov 22, 2024
1778a64
chore: inject org into editor title
Keyrxng Nov 22, 2024
d3de581
chore: storage getters
Keyrxng Nov 22, 2024
7bd56ac
chore: indicator after push without reload
Keyrxng Nov 22, 2024
f0f4808
chore: format
Keyrxng Nov 22, 2024
5c22031
chore: add/remove shift
Keyrxng Nov 26, 2024
cfef7be
chore: editor listeners, active remove for installed
Keyrxng Nov 26, 2024
728dd9f
chore: process typebox unions for convo-rewards
Keyrxng Nov 26, 2024
4344b97
chore: remove dupe storage set
Keyrxng Nov 26, 2024
0897172
chore: toast typos
Keyrxng Nov 26, 2024
40c4fce
chore: tracked listeners, normalize util
Keyrxng Nov 26, 2024
b2addf7
chore: required fields input assert and display
Keyrxng Nov 26, 2024
588377a
chore: more robust readme fetching, cleanup, input type assertion
Keyrxng Nov 26, 2024
1f61f21
chore: comments
Keyrxng Nov 26, 2024
22b7912
chore: fix config save
Keyrxng Nov 27, 2024
c2c587a
chore: auto dismiss add/remove plugin notification
Keyrxng Nov 27, 2024
728218d
chore: single push method, commit title update
Keyrxng Nov 27, 2024
1ac5807
fix: check for boolean input on user config injection
Keyrxng Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"],
"ignoreWords": ["ubiquibot", "Supabase", "supabase", "SUPABASE", "sonarjs", "mischeck"]
"ignoreWords": ["ubiquibot", "Supabase", "supabase", "SUPABASE", "sonarjs", "mischeck", "Typebox"]
}
2 changes: 2 additions & 0 deletions .github/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const config: KnipConfig = {
"@actions/core",
"esbuild",
"@ubiquity-os/plugin-sdk",
"markdown-it",
"@types/markdown-it",
],
eslint: true,
};
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@ubiquity-os/ubiquity-os-kernel": "^2.5.3",
"ajv": "^8.17.1",
"dotenv": "^16.4.4",
"markdown-it": "^14.1.0",
"yaml": "^2.6.0"
},
"devDependencies": {
Expand All @@ -51,6 +52,7 @@
"@jest/globals": "29.7.0",
"@mswjs/data": "0.16.1",
"@types/jest": "^29.5.12",
"@types/markdown-it": "^14.1.2",
"@types/node": "20.14.5",
"cspell": "8.14.4",
"cypress": "13.6.6",
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<tbody id="manifest-gui-body"></tbody>
<tfoot
><tr
><td></td><td><button id="remove"></button><button id="add"></button></td></tr
><td></td><td><button id="reset-to-default"></button><button id="remove"></button><button id="add"></button></td></tr
Keyrxng marked this conversation as resolved.
Show resolved Hide resolved
></tfoot>
</table>
</section>
Expand Down
37 changes: 16 additions & 21 deletions static/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AuthService } from "./scripts/authentication";
import { ManifestDecoder } from "./scripts/decode-manifest";
import { ManifestFetcher } from "./scripts/fetch-manifest";
import { ManifestRenderer } from "./scripts/render-manifest";
import { renderOrgPicker } from "./scripts/rendering/org-select";
import { toastNotification } from "./utils/toaster";

async function handleAuth() {
Expand All @@ -12,30 +12,31 @@ async function handleAuth() {

export async function mainModule() {
const auth = await handleAuth();
const decoder = new ManifestDecoder();
const renderer = new ManifestRenderer(auth);
const search = window.location.search.substring(1);

if (search) {
const decodedManifest = await decoder.decodeManifestFromSearch(search);
return renderer.renderManifest(decodedManifest);
}
renderer.manifestGuiBody.dataset.loading = "false";

try {
const ubiquityOrgsToFetchOfficialConfigFrom = ["ubiquity-os"];
const fetcher = new ManifestFetcher(ubiquityOrgsToFetchOfficialConfigFrom, auth.octokit, decoder);
const fetcher = new ManifestFetcher(ubiquityOrgsToFetchOfficialConfigFrom, auth.octokit);
const cache = fetcher.checkManifestCache();

if (auth.isActiveSession()) {
const userOrgs = await auth.getGitHubUserOrgs();
renderer.renderOrgPicker(userOrgs);

if (Object.keys(cache).length === 0) {
const manifestCache = await fetcher.fetchMarketplaceManifests();
localStorage.setItem("manifestCache", JSON.stringify(manifestCache));
// this is going to extract URLs from our official config which we'll inject into `- plugin: ...`
renderer.manifestGuiBody.dataset.loading = "true";
const killNotification = toastNotification("Fetching manifest data...", { type: "info", shouldAutoDismiss: true });
renderOrgPicker(renderer, []);

await fetcher.fetchMarketplaceManifests();
await fetcher.fetchOfficialPluginConfig();
killNotification();
renderer.manifestGuiBody.dataset.loading = "false";
}

renderOrgPicker(renderer, userOrgs);
} else {
renderer.renderOrgPicker([]);
renderOrgPicker(renderer, []);
}
} catch (error) {
if (error instanceof Error) {
Expand All @@ -46,10 +47,4 @@ export async function mainModule() {
}
}

mainModule()
.then(() => {
console.log("mainModule loaded");
})
.catch((error) => {
console.error(error);
});
mainModule().catch(console.error);
Loading