Giter VIP home page Giter VIP logo

code-push-server's People

Contributors

billxie1988 avatar byronigoe avatar chinachuner avatar chunge66 avatar devhyunjae avatar jeoy avatar kbrownlees avatar kimown avatar lisong avatar minomikula avatar openumbrella avatar renovate-bot avatar renovate[bot] avatar rocwind avatar ryanypm avatar snyk-bot avatar starlight36 avatar taichiyi avatar xuepx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

code-push-server's Issues

release fails on cordova/capacitor apps

Hi,

We started using your code-push-server and code-push-cli with capacitor plugin https://github.com/mapiacompany/capacitor-codepush and we found some problems. I believe that these problems are not present when used with the react-native release/plugins.

Most serious one is that second release will fail all the time if the output folder is not named CodePush. So "partial" release functionality is broken.

Steps to reproduce:

  1. prepare code push: code-push app add test-android android cordova
  2. create new folder and file with some content: echo "version 1" > ./test_folder/test_file
  3. create release: code-push release test-android ./test_folder "*"
  4. change file: echo "version 2" > ./test_folder/test_file
  5. release it again: code-push release test-android ./test_folder "*"

there is error on the server, and server instance will stop! (we are not using pm2, just simple node process)

Error: ENOENT: no such file or directory, stat 'C:\....\code-push-demo\workDir\codepush_Ye3hArNTWWsMkBtBAsGeLMEV04BID9dM\e592ede40edcc1a367b8c19d67de83811848f9345b682c39a2efff199a2f8a37\dataCenter\CodePush\test_file'
Emitted 'error' event on ZipFile instance at:
    at C:\...\code-push-demo\node_modules\yazl\index.js:31:26

I tried to investigate and found two problems:

First, this error should not kill whole node process. This is caused by improper error handling on zip file creation: on https://github.com/shm-open/code-push-server/blob/master/src/core/services/package-manager.ts#L233 it is not sufficient to add error handler to zipFile.outputStream.on('error'...).

If we check how ZipFile is throwing exeption https://github.com/thejoshwolfe/yazl/blob/master/index.js
we can see it used like: if (err) return self.emit("error", err); and util.inherits(ZipFile, EventEmitter);. So to catch these exeptions we need to add error handler on the zipFile instance: zipFile.on('error', (error)=>{ reject(error);}).

After this, the error will not kill whole server. Also after restart of the server everything looks ok-ish, because even if partial release failed to be created, the full release is used as fallback. So if someone is using for example pm2 this error could be unnoticed.

Second problem is error itself. The problem is that on https://github.com/shm-open/code-push-server/blob/master/src/core/utils/security.ts#L186-L189, when you are creating manifest file, the root folder is renamed to CodePush. So in my example of test_folder/test_file, the created manifest would contain something like this:

{
  'CodePush/test_file': 'b03d44cd60d71de68a4aca7808c6f768802f6d6c414430ff8ccea10c1aa57b4c'  
}

Then on the https://github.com/shm-open/code-push-server/blob/master/src/core/services/package-manager.ts#L287 in the generateOneDiffPackage function there is comparison of old and new manifest files. The result in my example run is ['CodePush/test_file']. Then this path is used to create zip file containing only changed files. On line https://github.com/shm-open/code-push-server/blob/master/src/core/services/package-manager.ts#L241 there is zipFile.addFile(path.join(baseDirectoryPath, file), slash(file)); but this file does not exist. In my example path is C:\....\code-push-demo\workDir\codepush_Ye3hArNTWWsMkBtBAsGeLMEV04BID9dM\e592ede40edcc1a367b8c19d67de83811848f9345b682c39a2efff199a2f8a37\dataCenter\CodePush\test_file. But without renaming it would be: C:\....\code-push-demo\workDir\codepush_Ye3hArNTWWsMkBtBAsGeLMEV04BID9dM\e592ede40edcc1a367b8c19d67de83811848f9345b682c39a2efff199a2f8a37\dataCenter\test_folder\test_file which exists.

I think if works for you only because during code-push release-react you are writing files to the folder named CodePush. From cli console: node node_modules\react-native\local-cli\cli.js bundle --assets-dest C:\***\Temp\CodePush\CodePush --bundle-output C:\***\Temp\CodePush\CodePush\index.android.bundle .....

But also react native apps do not need the renaming, in that case the renaming is: CodePush->CodePush (if code-push release-react is used or bundle/asset outpus is in CodePush folder). I think the correct fix should be to remove lines https://github.com/shm-open/code-push-server/blob/master/src/core/utils/security.ts#L186-L189.

In real word scenario the cordova builds have builded files in www folder and ionic capacitor .../public folder. In both cases the rename of the folder to CodePush in the manifest paths will result in error on second release.

I found this issue mentioned few times:
#75 (comment) They "fixed" issue by replacing rename.
the same thing here: lisong#319

The rename code originate from this PR: https://github-com.translate.goog/lisong/code-push-server/pull/236?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
Where they created react native build, but not in CodePush folder. I think the proper solution was either to change output folder, or fix hardcoded CodePush folder in the ios plugin. But still I do not understand how it was possible that they did not get the same error that we have now.

Just to double check if the partial update feature was not destroyed after I removed rename code. I tried it and it works without problems on our capacitor app: (note only one src_app_pages_profile_profile_module_ts file was changed)

VM3:192 result Filesystem.readdir (#100067870)
VM3:203 Objectfiles: (2) ['src_app_pages_profile_profile_module_ts.js', 'src_app_pages_profile_profile_module_ts.js.map'][[Prototype]]: Object
VM3:218 native Filesystem.stat (#100067871)
VM3:225 ObjectcallbackId: "100067871"methodName: "stat"options: {directory: 'DATA', path: 'codepush/download/unzipped/public/src_app_pages_profile_profile_module_ts.js'}pluginId: "Filesystem"[[Prototype]]: Object
VM3:192 result Filesystem.stat (#100067871)
....
VM3:192 result Filesystem.readFile (#100067875)
src_app_pages_profile_profile_module_ts.js:1088 [CodePush] Applying diff update

Thanks!
(I can create pull request if you accept, but I don't know how to test react-native/ios part)

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

How to delete release data?

Hi. The code push is now running on my personal server which does not have so much space. How do I view / delete the update packages from the server? I do not want to keep more than 3 update packages in history and delete the older ones to save space.

TODO

  • refactor to ts
  • add detailed logging for production
  • test coverage
  • simplify Promise based code (async - await)
  • use cookie based auth, so we can render more info (apps, deployments and etc) with views

不支持is_use_diff_text

你提到不支持is_use_diff_text,意思是没有增量更新哦,那针对弱网热更新问题,比如jsbundle在项目后期20M,这个多次热更新,那在弱网环境下面更新一次就全量下载,请问有好的解决方案吗,

[Redis] not support Redis Cluster

When I use Redis with Cluster Mode, I can not log in.
The server can not parser the MOVED, and returns 500 Internal Server Error.

Error log:

17:50:14 0|--  | level=info, time=2024-01-04 17:50:14.566, msg=try login, path=/auth/login, method=POST, requestId=3f6fc8c56bbc84d009b3dbcf668a25b1, account=admin
17:50:14 0|--  | level=error, time=2024-01-04 17:50:14.608, msg=MOVED 5285 [x.y.z.42:6379](http://x.y.z.42:6379/), path=/auth/login, method=POST, requestId=3f6fc8c56bbc84d009b3dbcf668a25b1, name=ReplyError, stack=ReplyError: MOVED5285 [x.y.z.42:6379](http://x.y.z.42:6379/)
17:50:14 0|--  |     at parseError (/data/node_modules/redis-parser/lib/parser.js:179:12)
17:50:14 0|--  |     at parseType (/data/node_modules/redis-parser/lib/parser.js:302:14)

Package version:
"redis": "4.2.0"

Package Hash missmatch with Code Signing

If release an update with Code Signing the package_hash stored in database have to be equal the hash inside JWT token (.codepushrelease). What is calculated by the server mismatch the hash inside JWT of the bundle.

Steps to reproduce:

  • Generate public and private key
  • Add the public key to config.xml <preference name="CodePushPublicKey" value="MIIBIjANB..."> (without ----BEGIN--- and without breaklines)
  • Release update with --privateKeyPath pointing to private key file.
  • Try update from the App.
  • You'll receive: The update contents failed the data integrity check.. StackTrace: packageHashSuccess

To fix:

  • Copy the bundle file from the server to your machine, add .zip to filename and extract.
  • Open the www/.codepushrelease and copy the content (this is a JWT).
  • Paste on https://jwt.io and copy the contentHash
  • Replace the column packages.update_hash with contentHash value.
  • Make sure refresh packages cache from server.
  • Try update again, and works.

Initial registration

  1. When I run code-push register http://localhost:3000 my browser opens the login page, but I think it's supposed to open the register page.
  2. Both auth/login and auth/register have no action defined on their forms, and thus the JavaScript code doesn't POST the data anywhere.
  3. I added /users/registerCode as the action to the register form, but it does not return the token that is expected.

I am happy to help complete the implementation of this, but I don't want to duplicate efforts if you've already done it, and I want to make sure I'm doing the right thing. Thanks.

在RN最新版本0.73中如何配置CodePush

在RN最新版本0.73中,没有了MainApplication.java文件,在MainApplication.kt如何配置CodePush?

override fun getPackages(): List<ReactPackage> = PackageList(this).packages.apply { add(CodePush( getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG, getResources().getString(R.string.CodePushServerURL) )) }
这样配置会报错

image

Dockerfile ${VERSION} is not being populated

It does not look like the VERSION is being populated correctly when doing the docker build. I believe is is working because npm install package@just installs the latest version available.

Help

关于code-push-server 使用问题,可以使用appcenter-cli客户端吗?我看目前是code-push-cli才行。我要怎么替换成appcenter-cli

Mandatory parameter semantic is different from official implmentation

The mandatory parameter is officially considered as: The mandatory attribute is unique because the server will dynamically modify it as necessary in order to ensure that the semantics of your releases are maintained for your end-users.

image

In code, the server now just returns the mandatory parameter as-is instead of deciding it dynamically.

Is this intentional, or do we have plans to implement that? Thank you in advance.

How to change URL download on client side?

Hello,

We currently use AppCenter codepush.
We want to change to have our own codepush server.

Even configuring this library, what is the correct process for changing server settings on the client side?
I'm using React Native.

Thanks.

Two releases with same content but diff signature and app, Will download same '.codepushrelease' final, Causing one of the signatures to fail verification.

Env:

  • server: shmopen/code-push-server:1.1.1
  • cli: 2.5.3
  • native plugin: capacitor-codepush

My issue steps:

  1. build project to $FOLDER
  2. release $FOLDER to $ANDROID_APP with $ANDROID_PRIVATE_KEY
  3. release $FOLDER to $IOS_APP with $IOS_PRIVATE_KEY
  4. open Android App, hot update success
  5. open iOS App, wrong signature

Have been checked:

  • Not cli problem. I checked table's 'packages/blob_url' two record's local file, thire '.codepushrelease' all have right content hash (they are diff with their signature)
  • So not native plugin problem
  • I found server update-info returnd download file all are 'packages_diff/diff_blob' record, and I checked diff_blob's local file, thire '.codepushrelease' content are same, so one of app must be got 'wrong signature'
  • So maybe the problem be 'code-push-server/diff-feature' related?

请问兼容到哪个版本的react-native-code-push?

我在项目里面使用的是[email protected],然后本地调试的时候配置的地址是http://127.0.0.1:3000

准备工作我已经都做好了,app也能正常跑起来。热更新的patch包也已经成功创建,我在数据库里面也能看到。但是在打开app的时候没有任何效果。也不知道到底请求了没有,也没有报错。

像这种情况我应该怎么排查可能是哪里的问题呢?包版本太高了?还是什么别的问题?

请大佬指教一下。万分感谢!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm standard-version Available

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): replace dependency standard-version with commit-and-tag-version 9.5.0
  • chore(deps): update dependency @types/bcryptjs to v2.4.6
  • chore(deps): update dependency @types/cookie-parser to v1.4.7
  • chore(deps): update dependency @types/yazl to v2.4.5
  • fix(deps): update dependency pug to v3.0.3
  • fix(deps): update dependency recursive-readdir to v2.2.3 (recursive-readdir, @types/recursive-readdir)
  • chore(deps): update dependency @types/lodash to v4.17.7
  • chore(deps): update dependency concurrently to v7.6.0
  • chore(deps): update dependency mocha to v10.6.0
  • chore(deps): update dependency supertest to v6.3.4
  • fix(deps): update dependency cos-nodejs-sdk-v5 to v2.14.3
  • fix(deps): update dependency formidable to v2.1.2 (formidable, @types/formidable)
  • fix(deps): update dependency node-fetch to v2.7.0 (node-fetch, @types/node-fetch)
  • fix(deps): update dependency qiniu to v7.12.0
  • fix(deps): update dependency validator to v13.12.0 (validator, @types/validator)
  • fix(deps): update dependency yargs to v17.7.2
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency concurrently to v8
  • chore(deps): update dependency nyc to v17
  • chore(deps): update dependency supertest to v7
  • chore(deps): update dependency typescript to v5
  • fix(deps): update dependency formidable to v3 (formidable, @types/formidable)
  • fix(deps): update dependency fs-extra to v11 (fs-extra, @types/fs-extra)
  • fix(deps): update dependency helmet to v7
  • fix(deps): update dependency jsonwebtoken to v9 (jsonwebtoken, @types/jsonwebtoken)
  • fix(deps): update dependency mysql2 to v3
  • fix(deps): update dependency slash to v5
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
github-actions
.github/workflows/nodejs.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • aliyun-oss-upload-stream 1.3.0
  • aliyun-sdk 1.12.4
  • aws-sdk 2.1176.0
  • bcryptjs 2.4.3
  • body-parser 1.20.0
  • cookie-parser 1.4.6
  • cos-nodejs-sdk-v5 2.11.12
  • express 4.18.1
  • extract-zip 2.0.1
  • formidable 2.0.1
  • fs-extra 10.1.0
  • helmet 5.1.0
  • i18n 0.15.0
  • jsonwebtoken 8.5.1
  • kv-logger 0.5.3
  • lodash 4.17.21
  • moment 2.29.3
  • mysql2 2.3.3
  • node-fetch 2.6.7
  • nodemailer 6.7.7
  • pug 3.0.2
  • qiniu 7.7.0
  • rand-token 1.0.1
  • recursive-readdir 2.2.2
  • redis 4.2.0
  • sequelize 6.21.3
  • slash 3.0.0
  • validator 13.7.0
  • yargs 17.5.1
  • yazl 2.5.1
  • @shm-open/eslint-config-bundle 1.9.13
  • @types/bcryptjs 2.4.2
  • @types/body-parser 1.19.2
  • @types/cookie-parser 1.4.3
  • @types/formidable 2.0.5
  • @types/fs-extra 9.0.13
  • @types/i18n 0.13.4
  • @types/jsonwebtoken 8.5.9
  • @types/lodash 4.14.195
  • @types/node-fetch 2.6.2
  • @types/nodemailer 6.4.5
  • @types/recursive-readdir 2.2.1
  • @types/validator 13.7.10
  • @types/yazl 2.4.2
  • concurrently 7.4.0
  • mocha 10.0.0
  • nyc 15.1.0
  • should 13.2.3
  • standard-version 9.5.0
  • supertest 6.2.4
  • supervisor 0.12.0
  • typescript 4.9.5
  • node >= 6.0
  • npm >= 3.10.8

  • Check this box to trigger a request for Renovate to run again on this repository

web login not working

HI, I installed the latest version as docker but when I tried to access via the web nothing happened. In the logs I see
code-push-server-server-1 | Error: ERR AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?
I'm trying with user: admin and password: 123456

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.