Giter Site home page Giter Site logo

Comments (19)

L-Jovi avatar L-Jovi commented on May 14, 2024 4

@lisong 明白了 再次感谢
我会向同事们推荐你的这个项目 解决了这一时期的空白

致意

from code-push-server.

lisong avatar lisong commented on May 14, 2024

直接访问 http://localhost:3000/download/+下载包名 呢?

from code-push-server.

lisong avatar lisong commented on May 14, 2024

react-native 项目的配置是?

from code-push-server.

lisong avatar lisong commented on May 14, 2024
http://127.0.0.1/updateCheck?deploymentKey=YourKey&appVersion=YourAppBinaryVersion&packageHash=&isCompanion=&label=&clientUniqueId=

返回值是?将url中的YourKey和YourAppBinaryVersion替换成你自己的

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024
  1. http://localhost:3000/download/+下载包名
    指的是 http://localhost:3000/download/FjEKlSkfRxPGs1YNo7PiW_drK8p0
    这样访问么
    返回也是 Not found

  2. RN 的配置指的是我的 Info.plist 文件嘛

    我仅仅按照 code-push 文档指定了 CodePushDeploymentKey 的键值属性

  3. 直接在浏览器访问下面的 api

http://127.0.0.1:3000/updateCheck?deploymentKey=XJiabUpIS6p7GIlSBLvdlwEDxEae4ksvOXqog&appVersion=0.2.2&packageHash=&isCompanion=&label=&clientUniqueId=

返回了我的热更新信息

{"updateInfo":{"downloadURL":"http://localhost:3000/download/Fv5JLn9fKmrJ4Mysnp6vEuj7_EB2","description":"\n    \n  本次更新\n    \n- 活跃维度下增加版本维度\n    \n- 横屏表格的日期控件报错\n    \n\n    \n  即将更新\n    \n- 图表支持点击查看数据\n    \n- 可查询日周月留存信息\n    \n","isAvailable":true,"isMandatory":true,"appVersion":"0.2.2","packageHash":"cb979a3e57ddbb5a84582bd5997d44c431e3f98fcd2681e54e31b4b5e6d9f7a9","label":"v1","packageSize":354064,"updateAppVersion":false,"shouldRunBinaryVersion":false}}

from code-push-server.

lisong avatar lisong commented on May 14, 2024

访问 http://localhost:3000/download/Fv5JLn9fKmrJ4Mysnp6vEuj7_EB2 这个地址呢?

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024

@lisong 感谢回复

在浏览器直接访问 http://localhost:3000/download/Fv5JLn9fKmrJ4Mysnp6vEuj7_EB2 也是 Not Found

from code-push-server.

lisong avatar lisong commented on May 14, 2024

终端有信息输出没?

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024

pm2 log 看了下实时的后台日志打印如下

0|code-pus | ::1 - - [14/Nov/2016:11:43:07 +0000] "GET /download/Fv5JLn9fKmrJ4Mysnp6vEuj7_EB2 HTTP/1.1" 404 10 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.87 Safari/537.36"
0|code-pus | Error: Not Found
0|code-pus |     at /Users/jovi/work/mock/code-push-server/app.js:69:13
0|code-pus |     at Layer.handle [as handle_request] (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/layer.js:95:5)
0|code-pus |     at trim_prefix (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:312:13)
0|code-pus |     at /Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:280:7
0|code-pus |     at Function.process_params (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:330:12)
0|code-pus |     at next (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:271:10)
0|code-pus |     at /Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:618:15
0|code-pus |     at next (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:256:14)
0|code-pus |     at Function.handle (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:176:3)
0|code-pus |     at router (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:46:12)
0|code-pus |     at Layer.handle [as handle_request] (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/layer.js:95:5)
0|code-pus |     at trim_prefix (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:312:13)
0|code-pus |     at /Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:280:7
0|code-pus |     at Function.process_params (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:330:12)
0|code-pus |     at next (/Users/jovi/work/mock/code-push-server/node_modules/express/lib/router/index.js:271:10)
0|code-pus |     at SendStream.error (/Users/jovi/work/mock/code-push-server/node_modules/serve-static/index.js:121:7)

from code-push-server.

lisong avatar lisong commented on May 14, 2024

好奇怪,这个express中很简单的 app.use('/download', express.static(.get(config, 'local.storageDir'))) 怎么找不到文件呢?
能不能在代码 app.use('/download', express.static(
.get(config, 'local.storageDir'))) 下面添加console.log(_.get(config, 'local.storageDir')); 然后看看目录是?

from code-push-server.

lisong avatar lisong commented on May 14, 2024

这样运行一下 pm2 restart process.yml,我知道啥原因了,目录应该先创建好,再启动server。

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024

很费解

我在 app.js 添加了 console.log(_.get(config, 'local.storageDir')) 之后用 pm2 重启了服务

然后浏览器访问 http://localhost:3000/download/Fv5JLn9fKmrJ4Mysnp6vEuj7_EB2 顺利下载到了文件

并且后台打印了路径 0|code-pus | /Users/jovi/work/mock/production/hotfix/workspaces/storage

然后我接着去 xcode 启动我的客户端项目 发现打印的日志仍旧是

2016-11-14 19:54:04.298 [info][tid:com.facebook.React.JavaScript] [CodePush] Error: 404: The specified resource does not exist.
RequestId:0b0d05ee-0002-006e-046d-3eb834000000
Time:2016-11-14T11:54:01.9837171Z

from code-push-server.

lisong avatar lisong commented on May 14, 2024

Info.plist 配置给我看看

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIcons</key>
    <dict/>
    <key>CFBundleIcons~ipad</key>
    <dict/>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>0.2.2</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>CodePushDeploymentKey</key>
    <string>XJiabUpIS6p7GIlSBLvdlwEDxEae4ksvOXqog</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSAppleMusicUsageDescription</key>
    <string>同意访问媒体库</string>
    <key>NSCalendarsUsageDescription</key>
    <string>同意访问日历</string>
    <key>NSCameraUsageDescription</key>
    <string>同意访问照相机</string>
    <key>NSContactsUsageDescription</key>
    <string>同意访问联系人</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>同意后台一直使用位置</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>同意定位</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>同意访问麦克风</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>同意访问媒体库</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>

from code-push-server.

lisong avatar lisong commented on May 14, 2024
<key>CodePushDeploymentKey</key>
<string>YourCodePushKey</string>
<key>CodePushServerURL</key>
<string>YourCodePushServerUrl</string>

指定YourCodePushServerUrl 地址为你的code-push-server 地址。要不然你的客户端不知道连接哪台机器下载文件

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024

@lisong 成功了 非常感谢!

from code-push-server.

lisong avatar lisong commented on May 14, 2024

如果配置到线上环境,downloadURLYourCodePushServerUrl 就需要用域名或者外网ip了,最好是用域名

from code-push-server.

L-Jovi avatar L-Jovi commented on May 14, 2024

@lisong 收到! 感谢你一直不断耐心的回复和建议 :)

最后一个小问题 config.js 中的

loginSecret: "CodePushServer"

生产环境下建议的随机字符串多长最好呢 linux 下有木有推荐的生成工具

再次感谢

致意!

from code-push-server.

lisong avatar lisong commented on May 14, 2024

随机生成字符串 openssl rand -base64 18
还有tryLoginTimes 这个产生环境最好也配置一下,可以防止别人暴力破解密码

from code-push-server.

Related Issues (20)

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.