Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ Seja Bem-Vindo a nossa página e atualização da Extensão da Discloud. Aqui vo

---

## 2.29.7

- Adição de ícones na interface da extensão, presentes em praticamente todas as seções, incluindo Apps (ao lado de Bot e Site), User.
- Correção de bugs no sistema de tradução, que anteriormente não aplicava grande parte dos textos.
- Melhoria no gerenciamento de subdomínios, permitindo criar e deletar diretamente pela extensão, sem precisar acessar o dashboard.
- Atualizações na interface de User:
- Exibição da RAM em MB de forma mais organizada
- Visualização do plano com suporte a português/inglês, acompanhado de ícone
- Identificação do idioma mais clara (ex: de pt-BR para Português (BR))

## 2.29.6

- Correção no sistema de autenticação, e orquestração de sessão.
Expand Down
3 changes: 3 additions & 0 deletions discloudconfigschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"ffmpeg",
"java",
"libgl",
"mysql",
"openssl",
"puppeteer",
"selenium",
"tesseract",
"tools"
]
}
Expand Down
13 changes: 11 additions & 2 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"action.cancel": "Cancel",
"action.cancelled": "Action cancelled",
"action.ok": "Yes",
"action.title": "Are you sure that you want to do {action}?",
"action.title": "Are you sure you want to perform this action?",
"app.status.errorCode": "Code error",
"app.status.off": "Off",
"app.status.on": "On",
Expand Down Expand Up @@ -60,10 +60,16 @@
"input.set.locale.available.title": "These are the available languages.",
"input.set.locale.prompt": "Set your language.",
"input.set.locale.validate": "Language must be like en-US.",
"input.subdomain.prompt": "Enter the subdomain name.",
"input.subdomain.validate": "Subdomain must use 2-20 lowercase letters, numbers or hyphens.",
"invalid.discloud.config": "The discloud.config file is invalid or does not exist.",
"invalid.discloud.config.main": "The {file} file specified in the main scope does not exist.",
"invalid.input": "Invalid input",
"invalid.token": "Invalid token.",
"label.user": "User",
"label.customdomain": "Custom Domains",
"label.teamapps": "Team Apps",
"label.subdomain": "Subdomains",
"label.apps.amount": "Amount of Apps",
"label.available.ram": "Available RAM",
"label.cpu": "CPU",
Expand All @@ -81,6 +87,7 @@
"missing.discloud.config.main": "The {file} file was not found in the list to ZIP.",
"missing.input": "Missing input",
"missing.locale": "Missing locale",
"missing.subdomain": "Missing subdomain",
"missing.moderator": "Missing mod",
"missing.moderator.id": "Missing mod ID",
"missing.team.appid": "Team app ID not found.",
Expand Down Expand Up @@ -126,6 +133,8 @@
"progress.start.title": "Start",
"progress.status.title": "Status",
"progress.stop.title": "Stop",
"progress.subdomain.create.title": "Create subdomain",
"progress.subdomain.delete.title": "Delete subdomain",
"progress.upload.title": "Upload",
"ratelimited": "You have reached the request limit. Try again in {s} seconds.",
"readdiscloudconfigdocs": "Read the [documentation](https://docs.discloud.com/en/discloud.config).",
Expand Down Expand Up @@ -170,4 +179,4 @@
"valid.token": "Token set up successfully!",
"your.app.is.now": "Your app {app} is now",
"your.team.app.is.now": "Your team app {app} is now"
}
}
13 changes: 11 additions & 2 deletions l10n/bundle.l10n.pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"action.cancel": "Cancelar",
"action.cancelled": "Ação cancelada",
"action.ok": "Ok",
"action.title": "Tem certeza que quer fazer {action}?",
"action.title": "Tem certeza de que deseja realizar esta ação?",
"app.status.errorCode": "Erro de código",
"app.status.off": "Desligado",
"app.status.on": "Ligado",
Expand Down Expand Up @@ -60,10 +60,19 @@
"input.set.locale.available.title": "Estes são os idiomas disponíveis.",
"input.set.locale.prompt": "Defina seu idioma.",
"input.set.locale.validate": "Idioma deve ser como pt-BR.",
"input.subdomain.prompt": "Digite o nome do subdominio.",
"input.subdomain.validate": "O subdominio deve usar 2-20 letras minusculas, numeros ou hifens.",
"missing.subdomain": "Subdominio nao encontrado",
"progress.subdomain.create.title": "Criar subdominio",
"progress.subdomain.delete.title": "Remover subdominio",
"invalid.discloud.config": "O arquivo discloud.config é inválido ou não existe.",
"invalid.discloud.config.main": "O arquivo {file} especificado no escopo principal não existe.",
"invalid.input": "Entrada inválida",
"invalid.token": "Token inválido.",
"label.user": "Usuário",
"label.customdomain": "Domínios Customizados",
"label.teamapps": "Apps de Equipe",
"label.subdomain": "Subdomínios",
"label.apps.amount": "Quant. de apps",
"label.available.ram": "RAM disponível",
"label.cpu": "CPU",
Expand Down Expand Up @@ -170,4 +179,4 @@
"valid.token": "Token configurado com sucesso!",
"your.app.is.now": "Seu app {app} agora está",
"your.team.app.is.now": "Seu app de equipe {app} agora está"
}
}
35 changes: 31 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Discloud",
"description": "Somos uma plataforma de nuvem baseada em contêiner que nasceu com a vontade de oferecer hospedagem fácil, rápida, gratuita e de qualidade.",
"publisher": "discloud",
"version": "2.29.6",
"version": "2.29.7",
"engines": {
"vscode": "^1.118.0"
},
Expand All @@ -25,7 +25,13 @@
"discloud.app",
"discloudbot",
"discord",
"host"
"host",
"hospedagem",
"host free",
"discloud.com",
"discloudbot.com",
"hosting",
"discord"
],
"categories": [
"Other"
Expand Down Expand Up @@ -244,6 +250,16 @@
"title": "%command.subdomain.refresh%",
"icon": "$(refresh)"
},
{
"command": "discloud.subdomain.create",
"title": "%command.subdomain.create%",
"icon": "$(add)"
},
{
"command": "discloud.subdomain.delete",
"title": "%command.subdomain.delete%",
"icon": "$(trash)"
},
{
"command": "discloud.team.backup",
"title": "%command.team.backup%",
Expand Down Expand Up @@ -1005,6 +1021,11 @@
"command": "discloud.user.set.locale",
"when": "view == discloudUser && discloudAuthorized"
},
{
"command": "discloud.subdomain.delete",
"group": "inline",
"when": "view == discloudSubdomains && viewItem =~ /^SubDomainTreeItem/"
},
{
"command": "discloud.logout",
"group": "inline",
Expand Down Expand Up @@ -1048,6 +1069,11 @@
"when": "view == discloudSubdomains",
"group": "navigation"
},
{
"command": "discloud.subdomain.create",
"when": "view == discloudSubdomains",
"group": "navigation"
},
{
"command": "discloud.team.refresh",
"when": "view == discloudTeamApps",
Expand Down Expand Up @@ -1237,15 +1263,15 @@
"icon": "resources/icons/discloud_icon.svg",
"name": "%view.subdomain.title%",
"visibility": "collapsed",
"when": "discloudAuthorized"
"when": "discloudAuthorized && discloudHasSubdomainsAccess"
},
{
"type": "tree",
"id": "discloudDomains",
"icon": "resources/icons/discloud_icon.svg",
"name": "%view.domain.title%",
"visibility": "collapsed",
"when": "discloudAuthorized"
"when": "discloudAuthorized && discloudHasCustomDomainsAccess"
},
{
"type": "tree",
Expand Down Expand Up @@ -1325,6 +1351,7 @@
"bytes": "^3.1.2",
"jose": "^6.2.3",
"json-schema-library": "^11.4.1",
"path": "^0.12.7",
"ws": "^8.21.0",
"yocto-queue": "^1.2.2"
},
Expand Down
6 changes: 4 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"command.login": "Login Discloud",
"command.logout": "Logout Discloud",
"command.logs": "Get app logs",
"command.subdomain.create": "Create subdomain",
"command.subdomain.delete": "Delete subdomain",
"command.subdomain.refresh": "Refresh subdomain list",
"command.team.backup": "Backup team app",
"command.team.commit": "Commit team app",
Expand Down Expand Up @@ -76,7 +78,7 @@
"config.team.sort.by.title": "Sort team app by",
"config.team.sort.online.description": "Show team apps with online status first",
"config.team.sort.online.title": "Show online team app first",
"config.token.description": "Your [Discloud](https://discloudbot.com) API token.",
"config.token.description": "Your [Discloud](https://discloud.com) API token.",
"config.upload.focus.logs": "Focus of logs during upload",
"config.upload.focus.logs.always.label": "Always",
"config.upload.focus.logs.errors.label": "Errors",
Expand Down Expand Up @@ -110,4 +112,4 @@
"welcome": "Welcome!",
"welcome.token.missing": "You have not yet provided a token to access Discloud resources.\n[Submit your Discloud token](command:discloud.login)",
"welcome.token.unauthorized": "You provided an invalid token to access Discloud resources.\n[Submit your Discloud token](command:discloud.login)"
}
}
6 changes: 4 additions & 2 deletions package.nls.pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"command.login": "Login Discloud",
"command.logout": "Logout Discloud",
"command.logs": "Obter logs do app",
"command.subdomain.create": "Criar subdominio",
"command.subdomain.delete": "Remover subdominio",
"command.subdomain.refresh": "Atualizar lista de subdomínios",
"command.team.backup": "Backup app de equipe",
"command.team.commit": "Commitar app de equipe",
Expand Down Expand Up @@ -76,7 +78,7 @@
"config.team.sort.by.title": "Ordenar app de equipe por",
"config.team.sort.online.description": "Mostrar apps de equipe com status online primeiro.",
"config.team.sort.online.title": "Mostrar apps de equipe online primeiro",
"config.token.description": "Seu token da API da [Discloud](https://discloudbot.com).",
"config.token.description": "Seu token da API da [Discloud](https://discloud.com).",
"config.upload.focus.logs": "Foco dos logs durante o upload",
"config.upload.focus.logs.always.label": "Sempre",
"config.upload.focus.logs.errors.label": "Erros",
Expand Down Expand Up @@ -110,4 +112,4 @@
"welcome": "Bem vindo!",
"welcome.token.missing": "Você ainda não forneceu um token para ter acesso aos recursos da Discloud.\n[Envie seu token Discloud](command:discloud.login)",
"welcome.token.unauthorized": "Você forneceu um token inválido para acessar os recursos do Discloud.\n[Envie seu token Discloud](command:discloud.login)"
}
}
1 change: 1 addition & 0 deletions resources/dark/bot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/carbon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/diamond.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/free.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/krypton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/platinum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/ruby.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/sapphire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/vibranium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/light/bot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/@types/api.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mudanças desnecessárias, a tipagem já existe na lib da discloud

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface ApiVscodeUser {
customdomains: string[]
locale: string
plan: string
planDataEnd?: string | null
ramUsedMb: number
subdomains: string[]
totalRamMb: number
Expand All @@ -35,3 +36,20 @@ export interface ApiVscodeApp extends BaseApiApp {
type: AppType
version: string
}

export interface ApiSubdomain {
date: number
id: string
status: number
userID: string
}

export interface RESTGetApiSubdomainResult extends RESTApiBaseResult {
subdomain?: ApiSubdomain
}

export interface RESTPostApiSubdomainResult extends RESTApiBaseResult {
subdomain?: ApiSubdomain
}

export interface RESTDeleteApiSubdomainResult extends RESTApiBaseResult {}
4 changes: 3 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ export async function commandsRegister(core: ExtensionCore) {
commandModuleRegister(core, "domain/refresh", await import("./commands/domain/refresh"));

// subdomain
commandModuleRegister(core, "subdomain/create", await import("./commands/subdomain/create"));
commandModuleRegister(core, "subdomain/delete", await import("./commands/subdomain/delete"));
commandModuleRegister(core, "subdomain/refresh", await import("./commands/subdomain/refresh"));

// team
commandModuleRegister(core, "team/backup", await import("./commands/team/backup"));
commandModuleRegister(core, "team/commit", await import("./commands/team/commit"));
Expand Down
39 changes: 39 additions & 0 deletions src/commands/subdomain/create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { t } from "@vscode/l10n";
import { ProgressLocation, window } from "vscode";
import { type RESTPostApiSubdomainResult, type TaskData } from "../../@types";
import type ExtensionCore from "../../core/extension";
import Command from "../../structures/Command";

const SUBDOMAIN_NAME_REGEXP = /^[a-z0-9-]{2,20}$/;

export default class extends Command {
constructor(core: ExtensionCore) {
super(core, {
progress: {
location: ProgressLocation.Notification,
title: t("progress.subdomain.create.title"),
},
});
}

async run(_: TaskData, subdomainName?: string) {
if (typeof subdomainName !== "string" || !SUBDOMAIN_NAME_REGEXP.test(subdomainName)) {
subdomainName = await window.showInputBox({
prompt: t("input.subdomain.prompt"),
validateInput(value) {
if (!SUBDOMAIN_NAME_REGEXP.test(value))
return t("input.subdomain.validate");
},
});
}

if (!subdomainName) throw Error(t("missing.subdomain"));

const response = await this.core.api.post<RESTPostApiSubdomainResult>(`/subdomain/${subdomainName}`);
if (!response) return;

void window.showInformationMessage(response.message ?? t("done"));

await this.core.user.fetch(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existe um comando para atualizar a lista de subdomínios, é melhor utilizar e adaptar o que já existe

}
}
35 changes: 35 additions & 0 deletions src/commands/subdomain/delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { t } from "@vscode/l10n";
import { ProgressLocation, window } from "vscode";
import { type RESTDeleteApiSubdomainResult, type TaskData } from "../../@types";
import type ExtensionCore from "../../core/extension";
import Command from "../../structures/Command";
import type SubDomainTreeItem from "../../structures/SubDomainTreeItem";

export default class extends Command {
constructor(core: ExtensionCore) {
super(core, {
progress: {
location: ProgressLocation.Notification,
title: t("progress.subdomain.delete.title"),
},
});
}

async run(_: TaskData, item: SubDomainTreeItem) {
const subdomainName = item.subdomain;

await this.confirmAction({
action: subdomainName,
throwOnReject: true,
title: "action.title",
type: "showWarningMessage",
});

const response = await this.core.api.delete<RESTDeleteApiSubdomainResult>(`/subdomain/${subdomainName}`);
if (!response) return;

void window.showInformationMessage(response.message ?? t("done"));

await this.core.user.fetch(true);
}
}
6 changes: 4 additions & 2 deletions src/events/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ core.on("activate", async function (context) {

core.logger.debug("Activate: done");

await commands.executeCommand("setContext", "discloudInitialized", true);
await commands.executeCommand("setContext", "discloudHasSubdomainsAccess", false);
await commands.executeCommand("setContext", "discloudHasCustomDomainsAccess", false);

await migrateAuthenticationProvider(core);

const session = await core.auth.getSession();
Expand All @@ -61,8 +65,6 @@ core.on("activate", async function (context) {
} else {
core.statusBar.reset();
}

await commands.executeCommand("setContext", "discloudInitialized", true);
});

async function migrateAuthenticationProvider(core: ExtensionCore) {
Expand Down
Loading
Loading