profile
viewpoint

closet6/dnsomatic 0

dnsomatic docker

closet6/jbashing 0

personal bash aliases and profiles with some versitility for the many many linux/bsd/osx machines I'm on

issue commentoakserver/oak

static site ... loading js files no mime type

also if i make the send look like below, its serves the js no problem:

    await send(context, context.request.url.pathname, {
      root: `/app/web`,
      index: "modules/puller-web.js",
    });
closet6

comment created time in a month

issue commentoakserver/oak

static site ... loading js files no mime type

Hi @closet6, I'm using https://deno.land/x/dejs and static files aren't called. So this is my solution:

router
  .get("/core/themes/boostrap/assets/:folder/:file", async (context) => {
    const folder = context.params.folder;
    const file = context.params.file;
    context.response.body = await Deno.readFile(
      `${Deno.cwd()}/core/themes/bootstrap/assets/${folder}/${file}`,
    );
  });
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link href="/core/themes/boostrap/assets/css/bootstrap.min.css" rel="stylesheet">
  <style>
    body {
      padding: 50px;
    }
  </style>
  <title><%- title %></title>
</head>
<body>

It will works fine!

@GuilhermeVendramini , do i have the wrong expectations for oak server, e.g. loading multiple static files from same root directory? Or is this a work around you are proposing? thx

closet6

comment created time in a month

issue commentoakserver/oak

static site ... loading js files no mime type

tried it on Brave (chrome) and its telling me 404, so not sure if that's a red herring or not, Firefox is complaining about a mime type (above)

  <script type="module" src="modules/puller-web.js"></script>
  <script type="module" src="modules/header.js"></script>
  <script type="module" src="modules/footer.js"></script>
  <link rel="stylesheet" type="text/css" href="sh.min.css">
  <link rel="stylesheet" type="text/css" href="footer.css">

doesn't return the css either, but still sends the index.html, that's why im not sure its a 404

the modules folder and css files are in the same directory as the index.html

this is the oak output, the browser is making the requests correctly i believe:

api_1  | { middleware: "IF_CHANGE_HAVE_BODY", path: "/modules/puller-web.js", method: "GET" }
api_1  | { middleware: "IF_CHANGE_HAVE_BODY", path: "/modules/header.js", method: "GET" }
api_1  | { middleware: "IF_CHANGE_HAVE_BODY", path: "/modules/footer.js", method: "GET" }
api_1  | { middleware: "IF_CHANGE_HAVE_BODY", path: "/sh.min.css", method: "GET" }
api_1  | { middleware: "IF_CHANGE_HAVE_BODY", path: "/footer.css", method: "GET" }

console in brave:


GET http://localhost:8000/modules/puller-web.js net::ERR_ABORTED 404 (Not Found)
localhost/:10 
GET http://localhost:8000/modules/header.js net::ERR_ABORTED 404 (Not Found)
localhost/:11 
GET http://localhost:8000/modules/footer.js net::ERR_ABORTED 404 (Not Found)
localhost/:12 
GET http://localhost:8000/sh.min.css net::ERR_ABORTED 404 (Not Found)
localhost/:13 
GET http://localhost:8000/footer.css net::ERR_ABORTED 404 (Not Found)

running in container, Deno 1.0.0 if i couldn't resolve the index.html this would make more sense to me.

I took out the cookie code to just in case.

closet6

comment created time in a month

issue commentoakserver/oak

static site ... loading js files no mime type

thanks, im just sending something now because i haven't abandoned this, but i've been traveling. I'll be trying to rework this this weekend.

closet6

comment created time in a month

issue commentoakserver/oak

static site ... loading js files no mime type

here is the code im using:

  .get("/", async (context) => {
    context.cookies.set(
      "lastVisit",
      new Date().toISOString(),
      { httpOnly: true, sameSite: "strict" },
    );
    await send(context, context.request.url.pathname, {
      root: `/app/web`,
      index: "index.html",
    });
  });

here is the html file script loads



  <script type="module" src="../modules/web.js"></script>
  <script type="module" src="../modules/header.js"></script>
  <script type="module" src="../modules/footer.js"></script>
closet6

comment created time in a month

issue commentoakserver/oak

static site ... loading js files no mime type

ok, thanks for the info, i will report back by end of week.

closet6

comment created time in a month

issue openedoakserver/oak

static site ... loading js files no mime type

hi, i'm getting this error when trying to host static site

the index.html is loading fine then when trying to load the js files (app) i get:

Loading module from “http://localhost:8000/modules/my-element.js” was blocked because of a disallowed MIME type (“”).

my assumption was oak would set the mime type based on extension. if im right is this a bug?

if im wrong is there any documentation that shows an example of the right way to set the the mime type for all served ".js" files?

thanks

created time in a month

issue commentrubiin/validator

when importing get typescript errors

nice job, thanks for the quick turnaround. confirmed with: deno cache -r https://deno.land/x/validatorjs/mod.ts

closet6

comment created time in a month

issue openedrubiin/validator

when importing get typescript errors

deno version: deno 1.0.2 v8 8.4.300 typescript 3.9.2

command: deno cache https://deno.land/x/validatorjs/mod.ts

errors:

error: TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ X: number; Y: number; Z: number; }'.
  No index signature with a parameter of type 'string' was found on type '{ X: number; Y: number; Z: number; }'.
    const number : any = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, char => charsValue[char]);
                                                                            ~~~~~~~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:29:77

TS7006 [ERROR]: Parameter 'str' implicitly has an 'any' type.
  'he-IL': (str) => {
            ~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:33:13

TS7006 [ERROR]: Parameter 'str' implicitly has an 'any' type.
  'ar-TN': (str) => {
            ~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:54:13

TS7006 [ERROR]: Parameter 'str' implicitly has an 'any' type.
  'zh-CN': (str) => {
            ~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:66:13

TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{ 11: string; 12: string; 13: string; 14: string; 15: string; 21: string; 22: string; 23: string; 31: string; 32: string; 33: string; 34: string; 35: string; 36: string; 37: string; 41: string; 42: string; 43: string; ... 16 more ...; 91: string; }'.
  No index signature with a parameter of type 'number' was found on type '{ 11: string; 12: string; 13: string; 14: string; 15: string; 21: string; 22: string; 23: string; 31: string; 32: string; 33: string; 34: string; 35: string; 36: string; 37: string; 41: string; 42: string; 43: string; ... 16 more ...; 91: string; }'.
      return !!provinceAndCitys[Number.parseInt(addressCode.substring(0, 2))];
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:113:16

TS7006 [ERROR]: Parameter 'birDayCode' implicitly has an 'any' type.
    const checkBirthDayCode = (birDayCode) => {
                               ~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:116:32

TS2769 [ERROR]: No overload matches this call.
  Overload 1 of 3, '(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string', gave the following error.
    Argument of type '(sum: number, number: string, index: number) => number | boolean' is not assignable to parameter of type '(previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string'.
      Types of parameters 'sum' and 'previousValue' are incompatible.
        Type 'string' is not assignable to type 'number'.
  Overload 2 of 3, '(callbackfn: (previousValue: number, currentValue: string, currentIndex: number, array: string[]) => number, initialValue: number): number', gave the following error.
    Argument of type '(sum: number, number: string, index: number) => number | boolean' is not assignable to parameter of type '(previousValue: number, currentValue: string, currentIndex: number, array: string[]) => number'.
      Type 'number | boolean' is not assignable to type 'number'.
        Type 'false' is not assignable to type 'number'.
    return Array.from(sanitized).reduce((sum, number, index) => {
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:218:41

TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ A: number; B: number; C: number; D: number; E: number; F: number; G: number; H: number; I: number; J: number; K: number; L: number; M: number; N: number; O: number; P: number; Q: number; R: number; S: number; T: number; U: number; ... 4 more ...; Z: number; }'.
  No index signature with a parameter of type 'string' was found on type '{ A: number; B: number; C: number; D: number; E: number; F: number; G: number; H: number; I: number; J: number; K: number; L: number; M: number; N: number; O: number; P: number; Q: number; R: number; S: number; T: number; U: number; ... 4 more ...; Z: number; }'.
        const code = ALPHABET_CODES[number];
                     ~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:220:22

TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ ES: (str: string) => boolean; 'he-IL': (str: any) => boolean; 'ar-TN': (str: any) => boolean; 'zh-CN': (str: any) => boolean; 'zh-TW': (str: string) => string | false; }'.
  No index signature with a parameter of type 'string' was found on type '{ ES: (str: string) => boolean; 'he-IL': (str: any) => boolean; 'ar-TN': (str: any) => boolean; 'zh-CN': (str: any) => boolean; 'zh-TW': (str: string) => string | false; }'.
    return validators[locale](str);
           ~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:237:12

TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ ES: (str: string) => boolean; 'he-IL': (str: any) => boolean; 'ar-TN': (str: any) => boolean; 'zh-CN': (str: any) => boolean; 'zh-TW': (str: string) => string | false; }'.
  No index signature with a parameter of type 'string' was found on type '{ ES: (str: string) => boolean; 'he-IL': (str: any) => boolean; 'ar-TN': (str: any) => boolean; 'zh-CN': (str: any) => boolean; 'zh-TW': (str: string) => string | false; }'.
        const validator = validators[key];
                          ~~~~~~~~~~~~~~~
    at https://deno.land/x/validatorjs/src/lib/isIdentityCard.ts:243:27

created time in 2 months

issue openedmanyuanrong/deno_mongo

createIndexes: panicked at 'not implemented

when trying to create an index like below,

users.createIndexes([
  {
    keys: { email: 1 },
    options: { unique: true },
  },
]);

i get this error:

api_1  | [IndexModel { keys: OrderedDocument({"email": I64(1)}), options: Some(OrderedDocument({"unique": Boolean(true)})) }]
api_1  | thread '<unnamed>' panicked at 'not implemented', <::std::macros::panic macros>:2:4
api_1  | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

am i calling it wrong, or does not implemented mean here that its not ready to be called yet?

tia

created time in 2 months

starteddenoland/deno

started time in 2 months

issue openedoakserver/oak

Argument of type 'Status.BadRequest' is not assignable to parameter of type 'ErrorStatus'.

error: TS2345 [ERROR]: Argument of type 'Status.BadRequest' is not assignable to parameter of type 'ErrorStatus'.
api_1  |     context.throw(Status.BadRequest, "Bad Request");

using example code in https://github.com/oakserver/oak/blob/master/examples/routingServer.ts

line 73

created time in 2 months

issue commentoakserver/oak

do i need to async await to get request.body() ?

very nice example, thank you very much

joeraygme

comment created time in 2 months

issue openedtypestack/class-transformer

Feature Request: produce a web-optimized "module" entrypoint

Description

Feature Request: produce a web-optimized "module" entrypoint

https://github.com/rollup/rollup/wiki/pkg.module

Reproduction

go to pika and search for: class-transformer

Environment

  • [ x] deno: 1

created time in 2 months

issue openedoakserver/oak

do i need to async await to get request.body() ?

Hi I'm working with this example: https://github.com/oakserver/oak/blob/master/examples/postGetServer.ts

when i implement it i seem to need this in order for it to return the body in the response:

  .put("/book", async ({ request, response }) => {
    if (!request.hasBody) {
      response.status = 400;
      response.body = { msg: "Invalid data" };
    } else {
      response.body = { msg: "Success", data: await request.body() };
    }
  });

should the example work as expressed and I'm doing something wrong?

created time in 2 months

issue openedNagarajnaidu921/URL_Shortner

Feature Request: Make a light icon for dark theme

When i run firefox in dark theme, i can't see your icon.

Love the tool though.

created time in 3 months

more