Explore all Development Tools open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Development Tools

FreeCAD

FreeCAD 0.19.4

MailHog

Mailhog 1.0.1

tools

latest w/ executables

LibreCAD

2.2.0 Release Candidate 2

devtools

devtools 2.4.3

Popular Libraries in Development Tools

FreeCAD

by FreeCAD doticonc++doticon

star image 11087 doticonNOASSERTION

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler. Issues are managed on our own bug tracker at https://www.freecadweb.org/tracker

MailHog

by mailhog doticongodoticon

star image 8827 doticonMIT

Web and API based SMTP testing

front-end-handbook-2018

by FrontendMasters doticonjavascriptdoticon

star image 4171 doticon

2018 edition of our front-end development handbook

front-end-handbook-2017

by FrontendMasters doticonjavascriptdoticon

star image 3866 doticon

2017 edition of our front-end development guide

tools

by googlecodelabs doticongodoticon

star image 3067 doticonApache-2.0

Codelabs management & hosting tools

MikuTools

by Ice-Hazymoon doticonjavascriptdoticon

star image 2892 doticonMIT

一个轻量的工具集合

DS4Windows

by Jays2Kings doticoncsharpdoticon

star image 2796 doticon

Like those other ds4tools, but sexier

roo

by roo-rb doticonrubydoticon

star image 2469 doticonMIT

Roo provides an interface to spreadsheets of several sorts.

LibreCAD

by LibreCAD doticonc++doticon

star image 2456 doticonNOASSERTION

LibreCAD is a cross-platform 2D CAD program written in C++11 using the Qt framework. It can read DXF and DWG files and can write DXF, PDF and SVG files. The user interface is highly customizable, and has dozens of translations.

Trending New libraries in Development Tools

f8x

by ffffffff0x doticonshelldoticon

star image 509 doticonApache-2.0

红/蓝队环境自动化部署工具

cpp_study

by chronolaw doticonc++doticon

star image 444 doticonBSD-2-Clause

follow me to study modern c++

CascadeStudio

by zalo doticonjavascriptdoticon

star image 430 doticonMIT

A Full Live-Scripted CAD Kernel in the Browser

RedTeam-OffensiveSecurity

by bigb0sss doticonpythondoticon

star image 322 doticonMIT

Tools & Interesting Things for RedTeam Ops

tinkerun

by tinkerun doticonjavascriptdoticon

star image 272 doticonMIT

A new way of Running Tinker. Simplify the Web Artisan's workflow.

opencascade.js

by donalffons doticonpythondoticon

star image 236 doticonLGPL-2.1

Port of the OpenCascade CAD library to JavaScript and WebAssembly via Emscripten.

OCCT

by Open-Cascade-SAS doticonc++doticon

star image 208 doticonLGPL-2.1

Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE. This is a clone of the official repository located on https://dev.opencascade.org/. Please use official development portal for registering issues and providing patches.

List-of-Tools

by IoT-PTv doticonshelldoticon

star image 204 doticon

List of the tools and usage

rbw

by doy doticonrustdoticon

star image 191 doticonNOASSERTION

unofficial bitwarden cli

Top Authors in Development Tools

1

cran

110 Libraries

star icon397

2

ropensci

48 Libraries

star icon2941

3

ropensci-archive

25 Libraries

star icon485

4

compute-io

10 Libraries

star icon34

5

ropenscilabs

10 Libraries

star icon311

6

r-lib

9 Libraries

star icon2862

7

eddelbuettel

8 Libraries

star icon392

8

mozilla

8 Libraries

star icon49

9

orbingol

6 Libraries

star icon410

10

tidymodels

5 Libraries

star icon806

1

110 Libraries

star icon397

2

48 Libraries

star icon2941

3

25 Libraries

star icon485

4

10 Libraries

star icon34

5

10 Libraries

star icon311

6

9 Libraries

star icon2862

7

8 Libraries

star icon392

8

8 Libraries

star icon49

9

6 Libraries

star icon410

10

5 Libraries

star icon806

Trending Discussions on Development Tools

Styles for overflow-y: scroll; not shown on mobile/tablet

UWP WebView2 ERR_NETWORK_ACESS_DENIED when loading an IP address (your internet access is blocked)

Problem installing old version of Rails 5.2.2 - Failed to build gem native extension

How to setup SDL2/SDL.h in visual studio?

cant find libl on centos 9 - /usr/bin/ld: cannot find -ll

Install XCode on MacOS 10.15 Catalina

How to handle 401 error status code error in Node.js/Express?

PowerPoint.Application.Presentations missing MsoTriState

How to secure a web app with login and database in 2022?

Javascript fetch is not sending Cookie Header (CORS)

QUESTION

Styles for overflow-y: scroll; not shown on mobile/tablet

Asked 2022-Mar-30 at 10:43

I have a browser-based mobile application and I want to highlight a vertical scroll that is in a certain section. The default vertical scroll styles for mobile/tablet are very subtle and many users overlook scrolling down in this section.

I show below my code and it works great in Google's mobile devices development tools but when I test it on a real mobile, none of my styles are shown, only the default mobile/tablet vertical scroll styles.

What can I do to make my code work for mobile devices?

Thanks!!!

1<style>
2    .introText{ 
3      width:400px;
4      height:200px;
5      overflow-y: scroll;
6    
7        scrollbar-face-color: #367CD2;
8        scrollbar-shadow-color: #FFFFFF;
9        scrollbar-highlight-color: #FFFFFF;
10        scrollbar-3dlight-color: #FFFFFF;
11        scrollbar-darkshadow-color: #FFFFFF;
12        scrollbar-track-color: #FFFFFF;
13        scrollbar-arrow-color: #FFFFFF;
14    }
15    
16    /* scroll started */
17    .introText::-webkit-scrollbar {
18        width: 12px;
19    }
20     
21    /* Track */
22    .introText::-webkit-scrollbar-track {
23        -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
24        -webkit-border-radius: 10px;
25        border-radius: 10px;
26    }
27     
28    /* Handle */
29    .introText::-webkit-scrollbar-thumb {
30        -webkit-border-radius: 10px;
31        border-radius: 10px;
32        background: rgba(255,0,0,0.8); 
33        -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
34    }
35</style>
36
37
38    <div class="introText">
39        <p>
40            "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."
41        </p>
42        <p>
43            <h5>Another</h5>
44    
45    "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."
46        </p>
47    <div>
48

ANSWER

Answered 2022-Mar-30 at 10:43

The webkit properties you are trying to use might not be supported on all browsers. You can check the compatibility here

Source https://stackoverflow.com/questions/71675606

QUESTION

UWP WebView2 ERR_NETWORK_ACESS_DENIED when loading an IP address (your internet access is blocked)

Asked 2022-Mar-18 at 14:37

After installing the WebView2 components for UWP and creating a project using these instructions, the web view cannot load a local IP Source="http://10.20.30.59/".

ERR_ACCESS_DENIED

  • The same URL works in WPF WebView, however I need to migrate because of other issues.
  • The same URL works in other browsers, just not in WebView2. "Normal" URLs like https://bing.com work fine in the WebView2.
  • Turning the firewall off still doesn't allow the content to load.
  • Turning off the Windows antivirus under Virus & threat protection settings does not help.
  • The CoreWebView2NavigationCompletedEventArgs.IsSuccess value is false and WebErrorStatus is ConnectionAborted.
  • Under DevTools > Network > Headers, the failed page has the value Referrer Policy: strict-origin-when-cross-origin. A visit to https://developer.chrome.com/blog/referrer-policy-new-chrome-default/ shows that this can be modified with Chrome flags, but I don't know how to run those flags to verify this is not the problem.
  • The feedback area has some similar issues like https://github.com/MicrosoftEdge/WebView2Feedback/issues/2145, but not one that shows how to debug it.
  • In the Package.appxmanifest, adding Internet (Client & Server), Internet (Client), Private Networks (Client & Server), and Remote System capabilities does not help.
  • Using Node JS + Node Package Manager to run a local server works on Source="http://10.20.30.106:8080/". This leads me to believe the problem is with the source itself. https://devpractical.com/host-a-html-page-on-localhost/#nodejs-section
  • The UWP sample WebView2Samples-master\SampleApps\webview2_sample_uwp from https://github.com/MicrosoftEdge/WebView2Samples works fine using the problematic address. Why?

Below is the minimal reproducible example from the instructions:

1<Page
2x:Class="WebView2_Test.MainPage"
3xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5xmlns:local="using:WebView2_Test"
6xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8mc:Ignorable="d"
9xmlns:control="using:Microsoft.UI.Xaml.Controls"
10Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
11
12<Grid>
13    <control:WebView2 x:Name="wv2"
14                      Source="http://10.20.30.59/"/>
15</Grid>
16

This involves first installing Edge Canary as recommended; installing the .NET desktop, C++ desktop, and UWP development tools in Visual Studio; and installing the Microsoft.Web.WebView2 and Microsoft.UI.Xaml prerelease NuGet packages.

How to debug what is preventing the source from loading?

ANSWER

Answered 2022-Mar-18 at 14:37

By comparing to the Microsoft sample, I found the missing capability, called Private Networks (Client & Server) in Package.appxmanifest. This is the only requirement for my project.

For whatever reason, when getting back to the project, this capability had gotten unchecked, so maybe restart Visual Studio or otherwise ensure that this capability has really been registered.

Source https://stackoverflow.com/questions/71502715

QUESTION

Problem installing old version of Rails 5.2.2 - Failed to build gem native extension

Asked 2022-Mar-18 at 11:20

I need to install older version of rails - 5.2.2 on Windows 10. I'm new to bash, so I went into this task blind, but I managed to install Ruby 2.5.0p0(which I also need). Now I've been stuck for few hours trying to figure out how to install rails. After running: $ gem install rails -v 5.2.2 I'm met with following error message:

1        ERROR: Failed to build gem native extension.
2
3    current directory: C:/Ruby25/lib/ruby/gems/2.5.0/gems/racc-1.6.0/ext/racc/cparse
4C:/Ruby25/bin/ruby.exe -r ./siteconf20220223-16448-scx6bw.rb extconf.rb
5checking for rb_block_call()... *** extconf.rb failed ***
6Could not create Makefile due to some reason, probably lack of necessary
7libraries and/or headers.  Check the mkmf.log file for more details.  You may
8need configuration options.
9
10Provided configuration options:
11        --with-opt-dir
12        --without-opt-dir
13        --with-opt-include
14        --without-opt-include=${opt-dir}/include
15        --with-opt-lib
16        --without-opt-lib=${opt-dir}/lib
17        --with-make-prog
18        --without-make-prog
19        --srcdir=.
20        --curdir
21        --ruby=C:/Ruby25/bin/$(RUBY_BASE_NAME)
22C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
23You have to install development tools first.
24        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
25        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
26        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:770:in `try_func'
27        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:1057:in `block in have_func'
28        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:947:in `block in checking_for'
29        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone'
30        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:320:in `open'
31        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone'
32        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:320:in `open'
33        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:346:in `postpone'
34        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:946:in `checking_for'
35        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:1056:in `have_func'
36        from extconf.rb:6:in `<main>'
37
38To see why this extension failed to compile, please check the mkmf.log which can be found here:
39
40  C:/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/racc-1.6.0/mkmf.log
41
42extconf failed, exit code 1
43
44Gem files will remain installed in C:/Ruby25/lib/ruby/gems/2.5.0/gems/racc-1.6.0 for inspection.
45Results logged to C:/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/racc-1.6.0/gem_make.out
46Temporarily enhancing PATH for MSYS/MINGW...
47Building native extensions. This could take a while...
48

The mkmf log:

1        ERROR: Failed to build gem native extension.
2
3    current directory: C:/Ruby25/lib/ruby/gems/2.5.0/gems/racc-1.6.0/ext/racc/cparse
4C:/Ruby25/bin/ruby.exe -r ./siteconf20220223-16448-scx6bw.rb extconf.rb
5checking for rb_block_call()... *** extconf.rb failed ***
6Could not create Makefile due to some reason, probably lack of necessary
7libraries and/or headers.  Check the mkmf.log file for more details.  You may
8need configuration options.
9
10Provided configuration options:
11        --with-opt-dir
12        --without-opt-dir
13        --with-opt-include
14        --without-opt-include=${opt-dir}/include
15        --with-opt-lib
16        --without-opt-lib=${opt-dir}/lib
17        --with-make-prog
18        --without-make-prog
19        --srcdir=.
20        --curdir
21        --ruby=C:/Ruby25/bin/$(RUBY_BASE_NAME)
22C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
23You have to install development tools first.
24        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
25        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
26        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:770:in `try_func'
27        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:1057:in `block in have_func'
28        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:947:in `block in checking_for'
29        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone'
30        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:320:in `open'
31        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone'
32        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:320:in `open'
33        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:346:in `postpone'
34        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:946:in `checking_for'
35        from C:/Ruby25/lib/ruby/2.5.0/mkmf.rb:1056:in `have_func'
36        from extconf.rb:6:in `<main>'
37
38To see why this extension failed to compile, please check the mkmf.log which can be found here:
39
40  C:/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/racc-1.6.0/mkmf.log
41
42extconf failed, exit code 1
43
44Gem files will remain installed in C:/Ruby25/lib/ruby/gems/2.5.0/gems/racc-1.6.0 for inspection.
45Results logged to C:/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/racc-1.6.0/gem_make.out
46Temporarily enhancing PATH for MSYS/MINGW...
47Building native extensions. This could take a while...
48"i686-w64-mingw32-gcc -o conftest.exe -IC:/Ruby25/include/ruby-2.5.0/i386-mingw32 -IC:/Ruby25/include/ruby-2.5.0/ruby/backward -IC:/Ruby25/include/ruby-2.5.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -march=i686 -mtune=generic -O2 -pipe conftest.c  -L. -LC:/Ruby25/lib -L. -pipe     -lmsvcrt-ruby250  -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
49checked program was:
50/* begin */
511: #include "ruby.h"
522: 
533: #include <winsock2.h>
544: #include <windows.h>
555: int main(int argc, char **argv)
566: {
577:   return 0;
588: }
59/* end */
60

I'm using git bash in case that matters.

ANSWER

Answered 2022-Mar-18 at 11:20

The problem occurred when ruby was installed using sudo apt install ruby.

Solution: Install ruby via RVM.

Source https://stackoverflow.com/questions/71242143

QUESTION

How to setup SDL2/SDL.h in visual studio?

Asked 2022-Mar-07 at 11:15

I tried to setup SDL 2 in visual studio following similar instruction to tutorial and the result was that visual studio was recognizing SDL.h but it was not recognizing SDL2/SDL.h and the include folder of sld2 development tools (link) does not have any SDL2/SDL.h file. How to setup SDL2/SDL.h in visual studio ?

ANSWER

Answered 2022-Mar-07 at 11:15

Actually SDL2 in SDL2/SDL.h is a folder.It is a folder that keeps SDL.h in the directory the compiler looks #include directives in.Change that include folder name to SDL2.

Source https://stackoverflow.com/questions/71362256

QUESTION

cant find libl on centos 9 - /usr/bin/ld: cannot find -ll

Asked 2022-Feb-23 at 23:05

Brand new install of centos 9. (mostly minimal)

I did a find and there is no libl.so on my machine.

sudo yum install bison Last metadata expiration check: 1:52:29 ago on Wed 23 Feb 2022 01:25:31 PM EST. Package bison-3.7.4-5.el9.x86_64 is already installed.

sudo yum install flex Last metadata expiration check: 1:52:25 ago on Wed 23 Feb 2022 01:25:31 PM EST. Package flex-2.6.4-9.el9.x86_64 is already installed.

sudo yum install flex-devel Last metadata expiration check: 1:52:35 ago on Wed 23 Feb 2022 01:25:31 PM EST. No match for argument: flex-devel

I tried installing sudo yum groupinstall 'Development Tools'

nothing works, any ideas?

ANSWER

Answered 2022-Feb-23 at 21:29

As you pointed out in the question - flex-devel is not found.

It's in the PowerTools repo.

The 'official' way to enable the repo is to use the yum config-manager command line:

1yum config-manager --set-enabled powertools
2

This may give an error about being missing the config-manager command:

1yum config-manager --set-enabled powertools
2No such command: config-manager
3

If this happens, then you can install the dnf-plugins-core package:

1yum config-manager --set-enabled powertools
2No such command: config-manager
3yum install -y dnf-plugins-core
4

and then enable the powertools repo, and then you should be able to yum install flex-devel, which provides:

1yum config-manager --set-enabled powertools
2No such command: config-manager
3yum install -y dnf-plugins-core
4$ rpmquery --list flex-devel
5/usr/lib64/libfl.a
6/usr/lib64/libfl_pic.a
7/usr/lib64/libl.a
8/usr/share/doc/flex
9/usr/share/licenses/flex-devel
10/usr/share/licenses/flex-devel/COPYING
11

Source https://stackoverflow.com/questions/71243580

QUESTION

Install XCode on MacOS 10.15 Catalina

Asked 2022-Feb-18 at 06:21

I'm getting an error where I can't install XCode because my MacOS version is 10.15 when the requirement is version 11 or higher.

I don't want to upgrade my mac version because this is a company laptop so my other development tools might get affected.

How do I create a workaround for this?

ANSWER

Answered 2021-Aug-30 at 12:43

You can download all versions of Xcode from this site

https://xcodereleases.com

Source https://stackoverflow.com/questions/68982941

QUESTION

How to handle 401 error status code error in Node.js/Express?

Asked 2022-Feb-10 at 22:18

I am working on login functionality in my project, now, flow looks like this (from front-end to back-end):

1async login() {
2  await login({
3    password: this.userPassword,
4    login: this.userLogin,
5    twoFactor: this.twoFactor
6  }).then((res) => {
7    if (res.error) {
8      //
9    } else {
10      console.log(res)
11    }
12  })
13}
14

And here is starts problems, as you can see if something goes wrong, I return status code 401 and some error message. When I login with correct data, there is no problem with getting token, but when I provide wrong data I have external pending login endpoint in development tools in browser and then, after some time, Error: Request failed with status code 401 in front end terminal. Without this status(401) with just JSON it works fine, but when I try to add 401 code, application crashes.

1async login() {
2  await login({
3    password: this.userPassword,
4    login: this.userLogin,
5    twoFactor: this.twoFactor
6  }).then((res) => {
7    if (res.error) {
8      //
9    } else {
10      console.log(res)
11    }
12  })
13}
14const userService = require('./../services/userService')
15const crypto = require('./../services/cryptoService')
16const jwt = require('./../services/jwtService')
17const twoFactorService = require('node-2fa')
18
19module.exports = {
20  login: async (req, res) => {
21    let { login, password, twoFactor } = req.body
22
23    password = crypto.encrypt(password, process.env.APP_KEY)
24    const result = await userService.getUserToLogin(login, password)
25
26    if (!result) {
27      res.status(401).json({
28        error: 'Unauthorized'
29      })
30    } else {
31      const faCode = result.twofatoken
32      const result2F = twoFactorService.verifyToken(faCode, twoFactor);
33      if ( !result2F || result2F.delta !== 0 ) {
34        res.status(401).json({
35          error: 'Unauthorized'
36        })
37      } else {
38        const userId = crypto.encrypt(result.id, process.env.CRYPTO_KEY)
39        const token = await jwt.sign({
40          uxd: userId,
41        });
42        res.json(token);
43      }
44    }
45  }
46}
47

Actually, I have no idea on what to do with that and how to handle this error.

ANSWER

Answered 2022-Feb-10 at 22:15

Ok, here is the answer. Actually, you just need to handle this error in your router:

1async login() {
2  await login({
3    password: this.userPassword,
4    login: this.userLogin,
5    twoFactor: this.twoFactor
6  }).then((res) => {
7    if (res.error) {
8      //
9    } else {
10      console.log(res)
11    }
12  })
13}
14const userService = require('./../services/userService')
15const crypto = require('./../services/cryptoService')
16const jwt = require('./../services/jwtService')
17const twoFactorService = require('node-2fa')
18
19module.exports = {
20  login: async (req, res) => {
21    let { login, password, twoFactor } = req.body
22
23    password = crypto.encrypt(password, process.env.APP_KEY)
24    const result = await userService.getUserToLogin(login, password)
25
26    if (!result) {
27      res.status(401).json({
28        error: 'Unauthorized'
29      })
30    } else {
31      const faCode = result.twofatoken
32      const result2F = twoFactorService.verifyToken(faCode, twoFactor);
33      if ( !result2F || result2F.delta !== 0 ) {
34        res.status(401).json({
35          error: 'Unauthorized'
36        })
37      } else {
38        const userId = crypto.encrypt(result.id, process.env.CRYPTO_KEY)
39        const token = await jwt.sign({
40          uxd: userId,
41        });
42        res.json(token);
43      }
44    }
45  }
46}
47router.post('/login', async (req, res) => {
48  try {
49    const data = await api.post('/login', req.body)
50    res.json(data.data)
51  } catch (e) {
52    // Probably you have here just console.log(e), but this way, you can handle it
53    res.status(e.response.status).json(e.response.data)
54  }
55})
56

Source https://stackoverflow.com/questions/71072852

QUESTION

PowerPoint.Application.Presentations missing MsoTriState

Asked 2022-Jan-13 at 21:12

I'm trying to automate a process using PowerPoint from C#, to do this I want to open (or create a new) PowerPoint presentation, add a slide, and save the document.

I've got the entire office 2019 package installed on my machine and can access the ppt api by referencing the Interop.Microsoft.Office.Interop.PowerPoint (from the Microsoft PowerPoint 16.0 Object Library reference) along with Interop.Microsoft.Office.Core (from the Microsoft Office 16.0 Object Library reference).

I try to open a powerpoint using the following code:

1using Microsoft.Office.Interop.PowerPoint;
2using Microsoft.Office.Core;
3
4class PowerPointManager
5{
6    public PowerPointManager()
7    {
8        string powerPointFileName = @"C:\temp\test.pptx";
9
10        Application pptApplication = new Application();
11        Presentation ppt = pptApplication.Presentations.Open(powerPointFileName, MsoTriState.msoTrue); //MsoTriState comes from Microsoft.Office.Core
12
13    }
14}
15
16

However this results in an error on the line pptApplication.Presentations.Open)

Error CS0012 The type 'MsoTriState' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

Even though MsoTriState is most definitely defined in Microsoft.Office.Core which is part of the office.dll assembly (msdn reference)

When I try to use VS2019's quick actions I get the option to "Add reference to "office Version 15.0.0.0"". Performing this quick actions opens up the Reference Manager, but does not add any references. Manually searching for "Office" doesn't yield any result simply named "office" either. The closest being "Microsoft Office 16.0 Object Library", which is already referenced.

As far as I can tell this is the same MsoTriStrate the function parameter is asking for, so why is it not accepting this? Trying to substitute the MsoTriState value for its integer value (e.g. -1 for true) doesn't work either.

Using .NET Core 3.1 WinForms, with Office 2019 (incl. powerpoint) 32bit, on W10 x64 enterprise and Visual Studio 2019 with the Office/Sharepoint development toolset installed.

ANSWER

Answered 2022-Jan-13 at 21:12

It looks like the interop assemblies were generated improperly by tlbimp at the certain point. You can find that assembly at \obj\Debug\netcoreapp3.1\Interop.Microsoft.Office.Interop.PowerPoint.dll.

To re-generate it properly, you need to do the following:

  1. Remove the reference to "Microsoft PowerPoint 16.0 Object Library". Clean and rebuild the project. You may also try unloading the project and removing the bin and obj folders manually at this point.
  2. Add references to both "Microsoft 15.0 Object Library" and "Microsoft 16.0 Object Library".
  3. Add back reference to "Microsoft PowerPoint 16.0 Object Library", and clean and rebuild the project once more.

After performing these steps, my .NET Core 3.1 WinForms project was compiled successfully.

Here are the contents of the .csproj file in my case:

1using Microsoft.Office.Interop.PowerPoint;
2using Microsoft.Office.Core;
3
4class PowerPointManager
5{
6    public PowerPointManager()
7    {
8        string powerPointFileName = @"C:\temp\test.pptx";
9
10        Application pptApplication = new Application();
11        Presentation ppt = pptApplication.Presentations.Open(powerPointFileName, MsoTriState.msoTrue); //MsoTriState comes from Microsoft.Office.Core
12
13    }
14}
15
16<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
17
18  <PropertyGroup>
19    <OutputType>WinExe</OutputType>
20    <TargetFramework>netcoreapp3.1</TargetFramework>
21    <UseWindowsForms>true</UseWindowsForms>
22  </PropertyGroup>
23
24  <ItemGroup>
25    <COMReference Include="Microsoft.Office.Core">
26      <WrapperTool>tlbimp</WrapperTool>
27      <VersionMinor>8</VersionMinor>
28      <VersionMajor>2</VersionMajor>
29      <Guid>2df8d04c-5bfa-101b-bde5-00aa0044de52</Guid>
30      <Lcid>0</Lcid>
31      <Isolated>false</Isolated>
32      <EmbedInteropTypes>true</EmbedInteropTypes>
33    </COMReference>
34    <COMReference Include="Microsoft.Office.Interop.PowerPoint">
35      <WrapperTool>tlbimp</WrapperTool>
36      <VersionMinor>12</VersionMinor>
37      <VersionMajor>2</VersionMajor>
38      <Guid>91493440-5a91-11cf-8700-00aa0060263b</Guid>
39      <Lcid>0</Lcid>
40      <Isolated>false</Isolated>
41      <EmbedInteropTypes>true</EmbedInteropTypes>
42    </COMReference>
43  </ItemGroup>
44
45</Project>
46

Source https://stackoverflow.com/questions/70562678

QUESTION

How to secure a web app with login and database in 2022?

Asked 2022-Jan-07 at 16:14

My security knowledge is very old and I want to refresh my full stack development tools. I'm learning about Oauth2, JWT, Next.JS, Auth0 and stuff, but I don't know how to bring all of that together. Please be patient with me, I put efforts in that question :)

Let's say I want to build a web app, where a user can register to a building. He is entering his personal data and receives a human friendly checkin number (e.g. A00001 - Z99999).

1o/    ___              
2/▌   |App| --POST---> API --> Add User to MySQL, create number-|
3/\    ———  <---------------------Send number back--------------|            
4
  1. How can I secure this /user POST path, to avoid getting spammed by a hacker?

Now there is a security man at the door of the building with the admin app. He get's all users and and clicks "ok" when the user enters the building.

1o/    ___              
2/▌   |App| --POST---> API --> Add User to MySQL, create number-|
3/\    ———  <---------------------Send number back--------------|            
4 O/    _________  ---PUT---> API --> Modify User                       
5/▌    |Admin App| ---GET---> API --> All Users -|
6/\     —————————  <-------send all users--------|
7
  1. How can I secure this /user GET path, so that only authenticated admins can get all users?
  2. How can I secure this /user PUT path, so that only authenticated admins can update users?
  3. The user should be able to login, but not register. There is only one admin account.

There is no registration for the admin. Only one admin with username and password login. User's don't need a GET /user/[id]. But optionally, is it secure, when I send them a link with a 32bit hash and then I open a GET /user/[hash]?

For those, how would love to help me with code, I'll bring a little with the question:

1o/    ___              
2/▌   |App| --POST---> API --> Add User to MySQL, create number-|
3/\    ———  <---------------------Send number back--------------|            
4 O/    _________  ---PUT---> API --> Modify User                       
5/▌    |Admin App| ---GET---> API --> All Users -|
6/\     —————————  <-------send all users--------|
7// pages/checkin.js
8export default function Checkin() {
9
10    const checkin = async (e) => {
11        e.preventDefault();
12        try {
13            await fetch('https://myapi.com/user', {method: "POST", data});
14        } catch (err) {
15            console.log(err);
16        }
17    }
18
19    return (
20        <div>
21            <form onSubmit={checkin}>
22                {/* ... */}
23            </form>        
24        </div>
25    )
26}
27
1o/    ___              
2/▌   |App| --POST---> API --> Add User to MySQL, create number-|
3/\    ———  <---------------------Send number back--------------|            
4 O/    _________  ---PUT---> API --> Modify User                       
5/▌    |Admin App| ---GET---> API --> All Users -|
6/\     —————————  <-------send all users--------|
7// pages/checkin.js
8export default function Checkin() {
9
10    const checkin = async (e) => {
11        e.preventDefault();
12        try {
13            await fetch('https://myapi.com/user', {method: "POST", data});
14        } catch (err) {
15            console.log(err);
16        }
17    }
18
19    return (
20        <div>
21            <form onSubmit={checkin}>
22                {/* ... */}
23            </form>        
24        </div>
25    )
26}
27// pages/_app.js
28import { UserProvider } from "@auth0/nextjs-auth0";
29
30function MyApp({ Component, pageProps }) {
31  return (
32    <UserProvider>
33      <Component {...pageProps} />
34    </UserProvider>
35  );
36}
37export default MyApp;
38
1o/    ___              
2/▌   |App| --POST---> API --> Add User to MySQL, create number-|
3/\    ———  <---------------------Send number back--------------|            
4 O/    _________  ---PUT---> API --> Modify User                       
5/▌    |Admin App| ---GET---> API --> All Users -|
6/\     —————————  <-------send all users--------|
7// pages/checkin.js
8export default function Checkin() {
9
10    const checkin = async (e) => {
11        e.preventDefault();
12        try {
13            await fetch('https://myapi.com/user', {method: "POST", data});
14        } catch (err) {
15            console.log(err);
16        }
17    }
18
19    return (
20        <div>
21            <form onSubmit={checkin}>
22                {/* ... */}
23            </form>        
24        </div>
25    )
26}
27// pages/_app.js
28import { UserProvider } from "@auth0/nextjs-auth0";
29
30function MyApp({ Component, pageProps }) {
31  return (
32    <UserProvider>
33      <Component {...pageProps} />
34    </UserProvider>
35  );
36}
37export default MyApp;
38// pages/api/auth/[...auth0].js
39import { handleAuth } from '@auth0/nextjs-auth0';
40
41export default handleAuth();
42
1o/    ___              
2/▌   |App| --POST---> API --> Add User to MySQL, create number-|
3/\    ———  <---------------------Send number back--------------|            
4 O/    _________  ---PUT---> API --> Modify User                       
5/▌    |Admin App| ---GET---> API --> All Users -|
6/\     —————————  <-------send all users--------|
7// pages/checkin.js
8export default function Checkin() {
9
10    const checkin = async (e) => {
11        e.preventDefault();
12        try {
13            await fetch('https://myapi.com/user', {method: "POST", data});
14        } catch (err) {
15            console.log(err);
16        }
17    }
18
19    return (
20        <div>
21            <form onSubmit={checkin}>
22                {/* ... */}
23            </form>        
24        </div>
25    )
26}
27// pages/_app.js
28import { UserProvider } from "@auth0/nextjs-auth0";
29
30function MyApp({ Component, pageProps }) {
31  return (
32    <UserProvider>
33      <Component {...pageProps} />
34    </UserProvider>
35  );
36}
37export default MyApp;
38// pages/api/auth/[...auth0].js
39import { handleAuth } from '@auth0/nextjs-auth0';
40
41export default handleAuth();
42// pages/userList.js
43import { useUser } from '@auth0/nextjs-auth0';
44
45export default function UserList() {
46  const { user, error, isLoading } = useUser();
47
48  if (isLoading) return <div>Loading...</div>;
49  if (error) return <div>{error.message}</div>;
50
51  {/*
52    * How and where do I fetch the secured users?
53    */}
54
55  const ok = async (id) => {
56      try {
57          /*
58           * How to secure the PUT?
59           */
60        await fetch('https://myapi.com', {method: 'PUT', data: {id, ok: true}})
61      } catch (err) {
62          console.log(err);
63      }
64  }
65
66  return (
67    user && (
68      <div>
69        {users.map((user) => (
70            <div key={user.id}>
71                {user.human_numer} - <button onClick={() => ok(user.id)}>OK</button>
72            </div>
73        ))}
74      </div>
75    )
76  );
77}
78

ANSWER

Answered 2022-Jan-07 at 16:14

So, some security tips from me (beware that I am not an security expert, just code web apps a lot):

  • Use bcrypt (https://www.npmjs.com/package/bcrypt). It is the best simple & secure module I have seen until now.
  • If you are using nodejs (which you are probably) and if you setted up your app with express, you can use express-ratelimit middleware to avoid spam.
  • To be honest, securing GET was a headache for me. Because internet is open by design, it is hard to disallow content sometimes. You can either:
    • Whitelist only your ip (if it is static) or match it with your user-agent etc. and disallow all other IPs. Note that this might be a trouble if you want to work on travel.
    • Use temporary bearer tokens that is for one time use. Note that if your db holding these or the token generator gets hacked, your whole app may fall, so be cautious.
  • The only login no register is easy. Just enter the credintials in your database manually.
  • Personally, I think you don't need to connect everything to a single domain. Set up a local (or not) dashboard and directly PUT users from there. Again, only whitelist your ip and disallow others.

Source https://stackoverflow.com/questions/70623804

QUESTION

Javascript fetch is not sending Cookie Header (CORS)

Asked 2022-Jan-05 at 12:52

I am trying to send Cookies to a PHP Script within a javascript fetch CORS request. The Request starts on https://sub1.example.com and contains the following options:

1let response = await fetch('https://sub2.example.com/target.php', {
2    method: "POST",
3    headers: headers,
4    body: formData,
5    mode: 'cors',
6    credentials: 'include',
7    cache: 'no-store'
8});
9

The corresponding PHP Script sets the following Headers:

1let response = await fetch('https://sub2.example.com/target.php', {
2    method: "POST",
3    headers: headers,
4    body: formData,
5    mode: 'cors',
6    credentials: 'include',
7    cache: 'no-store'
8});
9header('Access-Control-Allow-Origin: https://www.example.com');
10header('Access-Control-Allow-Methods: POST, OPTIONS');
11header('Access-Control-Allow-Credentials: true');
12header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With, Set-Cookie, Cookie, Bearer');
13

But the Cookie Header is not send with the request. I also tried:

1let response = await fetch('https://sub2.example.com/target.php', {
2    method: "POST",
3    headers: headers,
4    body: formData,
5    mode: 'cors',
6    credentials: 'include',
7    cache: 'no-store'
8});
9header('Access-Control-Allow-Origin: https://www.example.com');
10header('Access-Control-Allow-Methods: POST, OPTIONS');
11header('Access-Control-Allow-Credentials: true');
12header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With, Set-Cookie, Cookie, Bearer');
13let headers = new Headers();
14headers.set('Cookie', document.cookie);
15

That also had no effect. What exactly am I doing wrong here?

I checked the Network Tab in the Development Tools. Also $_COOKIE in the PHP Script is empty. There is absolutely no error. I can also see that the Cookie Header is sent in any not CORS fetch request.

EDIT: Here are the Settings of one of the Cookies:

1let response = await fetch('https://sub2.example.com/target.php', {
2    method: "POST",
3    headers: headers,
4    body: formData,
5    mode: 'cors',
6    credentials: 'include',
7    cache: 'no-store'
8});
9header('Access-Control-Allow-Origin: https://www.example.com');
10header('Access-Control-Allow-Methods: POST, OPTIONS');
11header('Access-Control-Allow-Credentials: true');
12header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With, Set-Cookie, Cookie, Bearer');
13let headers = new Headers();
14headers.set('Cookie', document.cookie);
15Name: PHPSESSID
16Path: /
17Secure: true
18SameSite: none
19

I can't share the Domain because it's not public. But the Cookie Domain has the same Value as the Origin in the Request Header (Minus the https://).

EDIT 2: Changed the fetch URL to make clearer what's happening.

ANSWER

Answered 2022-Jan-05 at 09:38

Cookies normally are not supposed to be attached to preflight requests in CORS mode. You might want to check this out.

Note: Browsers should not send credentials in preflight requests irrespective of this setting. For more information see: CORS > Requests with credentials.

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

Source https://stackoverflow.com/questions/70590447

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Development Tools

Tutorials and Learning Resources are not available at this moment for Development Tools

Share this Page

share link

Get latest updates on Development Tools