Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Enforce lower-case subdomains
Alexis Sellier committed 4 years ago
commit 59fe1187ebc98f6ac67ee822fa9ac17b24352ae9
parent bf363d7c05b1ea23259dfc0b5293c0d4d4488f78
2 files changed +8 -0
modified src/base/registrations/New.svelte
@@ -23,6 +23,9 @@
  export let subdomain: string;
  export let owner: string | null;

+
  // We only support lower-case names.
+
  subdomain = subdomain.toLowerCase();
+

  let fee: string;
  let state = State.CheckingAvailability;
  let error: string | null = null;
modified src/base/registrations/registrar.ts
@@ -50,6 +50,8 @@ state.subscribe((s: Connection) => {
});

export async function getRegistration(name: string, config: Config): Promise<Registration | null> {
+
  name = name.toLowerCase();
+

  const resolver = await config.provider.getResolver(name);
  if (! resolver) {
    return null;
@@ -96,6 +98,8 @@ export async function registerName(name: string, owner: string, config: Config):

  if (! name) return;

+
  name = name.toLowerCase();
+

  const commitmentJson = window.localStorage.getItem('commitment');
  const commitment = commitmentJson && JSON.parse(commitmentJson);

@@ -120,6 +124,7 @@ async function commitAndRegister(name: string, owner: string, config: Config): P
  if ((await config.token.balanceOf(owner)).lt(fee)) {
    throw { type: Failure.InsufficientBalance, message: "Not enough RAD funds" };
  }
+
  name = name.toLowerCase();

  await commit(makeCommitment(name, owner, salt), fee, minAge, config);
  // Save commitment in local storage in case the user refreshes or closes